mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
2000-02-08
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
25be6ce9b5
commit
320e99d8dd
33 changed files with 1157 additions and 516 deletions
16
eval.c
16
eval.c
|
@ -7266,21 +7266,21 @@ rb_thread_scope_shared_p()
|
|||
|
||||
static VALUE
|
||||
rb_thread_yield(arg, th)
|
||||
int arg;
|
||||
VALUE arg;
|
||||
thread_t th;
|
||||
{
|
||||
scope_dup(ruby_block->scope);
|
||||
return rb_yield_0(th->thread, 0, 0, Qfalse);
|
||||
return rb_yield_0(arg, 0, 0, Qfalse);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_thread_start(klass)
|
||||
VALUE klass;
|
||||
rb_thread_start(klass, args)
|
||||
VALUE klass, args;
|
||||
{
|
||||
if (!rb_iterator_p()) {
|
||||
rb_raise(rb_eThreadError, "must be called as iterator");
|
||||
}
|
||||
return rb_thread_create_0(rb_thread_yield, 0, klass);
|
||||
return rb_thread_create_0(rb_thread_yield, args, klass);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -7708,9 +7708,9 @@ Init_Thread()
|
|||
rb_eThreadError = rb_define_class("ThreadError", rb_eStandardError);
|
||||
rb_cThread = rb_define_class("Thread", rb_cObject);
|
||||
|
||||
rb_define_singleton_method(rb_cThread, "new", rb_thread_start, 0);
|
||||
rb_define_singleton_method(rb_cThread, "start", rb_thread_start, 0);
|
||||
rb_define_singleton_method(rb_cThread, "fork", rb_thread_start, 0);
|
||||
rb_define_singleton_method(rb_cThread, "new", rb_thread_start, -2);
|
||||
rb_define_singleton_method(rb_cThread, "start", rb_thread_start, -2);
|
||||
rb_define_singleton_method(rb_cThread, "fork", rb_thread_start, -2);
|
||||
|
||||
rb_define_singleton_method(rb_cThread, "stop", rb_thread_stop, 0);
|
||||
rb_define_singleton_method(rb_cThread, "kill", rb_thread_s_kill, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue