Revision: 1942 http://trac.macosforge.org/projects/ruby/changeset/1942 Author: lsansonetti@apple.com Date: 2009-06-26 19:04:02 -0700 (Fri, 26 Jun 2009) Log Message: ----------- more MT compliance Modified Paths: -------------- MacRuby/branches/experimental/thread.c MacRuby/branches/experimental/vm.cpp Modified: MacRuby/branches/experimental/thread.c =================================================================== --- MacRuby/branches/experimental/thread.c 2009-06-27 01:24:26 UTC (rev 1941) +++ MacRuby/branches/experimental/thread.c 2009-06-27 02:04:02 UTC (rev 1942) @@ -313,7 +313,7 @@ rb_thread_wakeup(VALUE thread, SEL sel) { rb_vm_thread_wakeup(GetThreadPtr(thread)); - return Qnil; + return thread; } /* @@ -338,8 +338,9 @@ static VALUE rb_thread_run(VALUE thread, SEL sel) { - // On MacRuby, #wakeup and #run are the same. - return rb_thread_wakeup(thread, 0); + rb_vm_thread_wakeup(GetThreadPtr(thread)); + pthread_yield_np(); + return thread; } /* Modified: MacRuby/branches/experimental/vm.cpp =================================================================== --- MacRuby/branches/experimental/vm.cpp 2009-06-27 01:24:26 UTC (rev 1941) +++ MacRuby/branches/experimental/vm.cpp 2009-06-27 02:04:02 UTC (rev 1942) @@ -4409,6 +4409,7 @@ pthread_cleanup_push(rb_vm_thread_destructor, (void *)thread); rb_vm_thread_t *t = GetThreadPtr(thread); + try { VALUE val = rb_vm_block_eval(t->body, t->argc, t->argv); GC_WB(&t->value, val); @@ -4416,6 +4417,7 @@ catch (...) { // TODO handle thread-level exceptions. //printf("exception raised inside thread %p\n", pthread_self()); + t->value = Qfalse; } pthread_cleanup_pop(0);