Modified: MacRuby/branches/experimental/thread.c (1941 => 1942)
--- 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 (1941 => 1942)
--- 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);