summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-19 14:59:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-19 14:59:52 +0000
commitdb00c782f4d477e04217b8da9782d9fe3c515675 (patch)
tree63d180cb2229370671fa69e1f04bf75840c3f103 /eval.c
parentd43b40dbddde5d5bdb9efbf63978507d4f08d762 (diff)
* 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
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/eval.c b/eval.c
index c044f7d8a3..220af68294 100644
--- a/eval.c
+++ b/eval.c
@@ -6625,19 +6625,20 @@ rb_provide(feature)
rb_provide_feature(rb_str_new2(feature));
}
-static void
+static int
load_wait(ftptr)
char *ftptr;
{
st_data_t th;
- if (!loading_tbl) return;
- if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return;
- if ((rb_thread_t)th == curr_thread) return;
+ if (!loading_tbl) return Qfalse;
+ if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return Qfalse;
+ if ((rb_thread_t)th == curr_thread) return Qtrue;
do {
CHECK_INTS;
rb_thread_schedule();
} 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;
found = search_required(fname, &feature, &path);
if (found) {
- if (!path) {
- load_wait(RSTRING(feature)->ptr);
+ if (!path || load_wait(RSTRING(feature)->ptr)) {
result = Qfalse;
}
else {
ruby_safe_level = 0;
- rb_provide_feature(feature);
switch (found) {
case 'r':
/* loading ruby library should be serialized. */
@@ -6795,6 +6794,7 @@ rb_require_safe(fname, safe)
rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
break;
}
+ rb_provide_feature(feature);
result = Qtrue;
}
}