diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-23 09:28:31 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-23 09:28:31 +0000 |
commit | e8122fadd454723c4b557f30f53dbd3b88c1606d (patch) | |
tree | 6e7304303a98d100cccae077c2f2829fc839441c /eval.c | |
parent | e6f839c47cefb31391c286e22b7bd9c0d45e31ae (diff) |
merge revision(s) 17874,17886:
* eval.c (rb_thread_join): new API.
* ext/thread/thread.c (wait_mutex, lock_mutex): wait until the locking
thread exits. [ruby-dev:34856]
* eval.c (rb_thread_value): missed to change at r17874. [ruby-core:17595]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@23044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -1440,8 +1440,6 @@ eval_node(self, node) int ruby_in_eval; -static int rb_thread_join _((rb_thread_t, double)); - static void rb_thread_cleanup _((void)); static void rb_thread_wait_other_threads _((void)); @@ -11413,8 +11411,11 @@ rb_thread_select(max, read, write, except, timeout) return curr_thread->select_value; } +static int rb_thread_join0 _((rb_thread_t, double)); +int rb_thread_join _((VALUE, double)); + static int -rb_thread_join(th, limit) +rb_thread_join0(th, limit) rb_thread_t th; double limit; { @@ -11456,6 +11457,15 @@ rb_thread_join(th, limit) return Qtrue; } +int +rb_thread_join(thread, limit) + VALUE thread; + double limit; +{ + if (limit < 0) limit = DELAY_INFTY; + return rb_thread_join0(rb_thread_check(thread), limit); +} + /* * call-seq: @@ -11505,11 +11515,10 @@ rb_thread_join_m(argc, argv, thread) { VALUE limit; double delay = DELAY_INFTY; - rb_thread_t th = rb_thread_check(thread); rb_scan_args(argc, argv, "01", &limit); if (!NIL_P(limit)) delay = rb_num2dbl(limit); - if (!rb_thread_join(th, delay)) + if (!rb_thread_join0(rb_thread_check(thread), delay)) return Qnil; return thread; } @@ -12499,7 +12508,7 @@ rb_thread_value(thread) { rb_thread_t th = rb_thread_check(thread); - while (!rb_thread_join(th, DELAY_INFTY)); + while (!rb_thread_join0(th, DELAY_INFTY)); return th->result; } |