summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-25 06:18:07 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-25 06:18:07 +0000
commite748f56a6bea5b17339d70b767311897769a7c97 (patch)
tree5fac7807a4677c97f177ddb7c01e9f240ea1d097 /eval.c
parenta42bf2edd007da6ae32a4162236eca21b5c9d365 (diff)
* ext/socket/socket.c (bsock_do_not_rev_lookup_set): should not be
allowed when $SAFE > 3. * eval.c (rb_thread_ready): THREAD_TO_KILL threads should not turn into THREAD_RUNNABLE on wakeup. * eval.c (rb_thread_list): THREAD_TO_KILL threads should be in the list. * eval.c (thgroup_list): ditto; by moving gid clearance from rb_thread_cleanup(). * dir.c (fnmatch): "*/bar" (with FNM_PATHNAME flag) does not match "foo/bar". * io.c (read_all): files on /proc filesystem with zero stat size, may have contents. * ext/socket/socket.c (tcp_s_gethostbyname): refactored. * ext/socket/socket.c (sock_s_gethostbyname): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index 7446149ad0..b270f9c169 100644
--- a/eval.c
+++ b/eval.c
@@ -7527,7 +7527,9 @@ rb_thread_ready(th)
rb_thread_t th;
{
th->wait_for = 0;
- th->status = THREAD_RUNNABLE;
+ if (th->status != THREAD_TO_KILL) {
+ th->status = THREAD_RUNNABLE;
+ }
}
static void
@@ -7538,6 +7540,7 @@ rb_thread_remove(th)
rb_thread_ready(th);
th->status = THREAD_KILLED;
+ th->gid = 0;
th->prev->next = th->next;
th->next->prev = th->prev;
}
@@ -7843,7 +7846,6 @@ rb_thread_schedule()
}
END_FOREACH_FROM(curr, th);
next = main_thread;
- next->gid = 0;
rb_thread_ready(next);
next->status = THREAD_TO_KILL;
rb_thread_save_context(curr_thread);
@@ -8121,6 +8123,7 @@ rb_thread_list()
switch (th->status) {
case THREAD_RUNNABLE:
case THREAD_STOPPED:
+ case THREAD_TO_KILL:
rb_ary_push(ary, th->thread);
default:
break;
@@ -8936,12 +8939,12 @@ rb_thread_inspect(thread)
void
rb_thread_atfork()
{
-#if 1 /* enable on 1.7 */
rb_thread_t th;
if (rb_thread_alone()) return;
FOREACH_THREAD(th) {
if (th != curr_thread) {
+ th->gid = 0;
th->status = THREAD_KILLED;
}
}
@@ -8949,7 +8952,6 @@ rb_thread_atfork()
main_thread = curr_thread;
curr_thread->next = curr_thread;
curr_thread->prev = curr_thread;
-#endif
}
static VALUE rb_cCont;