* eval.c (rb_require_safe): provide the feature after loaded.

[ruby-list:40085]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-10-19 14:59:52 +00:00
Родитель d43b40dbdd
Коммит db00c782f4
2 изменённых файлов: 13 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Tue Oct 19 23:59:46 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_require_safe): provide the feature after loaded.
[ruby-list:40085]
Tue Oct 19 22:43:12 2004 Dave Thomas <dave@pragprog.com> Tue Oct 19 22:43:12 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_attr): If * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_attr): If

14
eval.c
Просмотреть файл

@ -6625,19 +6625,20 @@ rb_provide(feature)
rb_provide_feature(rb_str_new2(feature)); rb_provide_feature(rb_str_new2(feature));
} }
static void static int
load_wait(ftptr) load_wait(ftptr)
char *ftptr; char *ftptr;
{ {
st_data_t th; st_data_t th;
if (!loading_tbl) return; if (!loading_tbl) return Qfalse;
if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return; if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return Qfalse;
if ((rb_thread_t)th == curr_thread) return; if ((rb_thread_t)th == curr_thread) return Qtrue;
do { do {
CHECK_INTS; CHECK_INTS;
rb_thread_schedule(); rb_thread_schedule();
} while (st_lookup(loading_tbl, (st_data_t)ftptr, &th)); } while (st_lookup(loading_tbl, (st_data_t)ftptr, &th));
return Qtrue;
} }
/* /*
@ -6762,13 +6763,11 @@ rb_require_safe(fname, safe)
ruby_safe_level = safe; ruby_safe_level = safe;
found = search_required(fname, &feature, &path); found = search_required(fname, &feature, &path);
if (found) { if (found) {
if (!path) { if (!path || load_wait(RSTRING(feature)->ptr)) {
load_wait(RSTRING(feature)->ptr);
result = Qfalse; result = Qfalse;
} }
else { else {
ruby_safe_level = 0; ruby_safe_level = 0;
rb_provide_feature(feature);
switch (found) { switch (found) {
case 'r': case 'r':
/* loading ruby library should be serialized. */ /* loading ruby library should be serialized. */
@ -6795,6 +6794,7 @@ rb_require_safe(fname, safe)
rb_ary_push(ruby_dln_librefs, LONG2NUM(handle)); rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
break; break;
} }
rb_provide_feature(feature);
result = Qtrue; result = Qtrue;
} }
} }