[macruby-changes] [2668] MacRuby/trunk/gcd.c
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 28 19:11:06 PDT 2009
Revision: 2668
http://trac.macosforge.org/projects/ruby/changeset/2668
Author: lsansonetti at apple.com
Date: 2009-09-28 19:11:04 -0700 (Mon, 28 Sep 2009)
Log Message:
-----------
removed the PRE/POST_VM_GCD and instead mark the core as multithreaded by default (and never set it off, heh, too bad)
Modified Paths:
--------------
MacRuby/trunk/gcd.c
Modified: MacRuby/trunk/gcd.c
===================================================================
--- MacRuby/trunk/gcd.c 2009-09-29 02:10:23 UTC (rev 2667)
+++ MacRuby/trunk/gcd.c 2009-09-29 02:11:04 UTC (rev 2668)
@@ -104,13 +104,6 @@
static VALUE cSource;
static VALUE cSemaphore;
-#define PRE_VM_GCD \
- const bool __mt = rb_vm_is_multithreaded(); \
- rb_vm_set_multithreaded(__mt);
-
-#define POST_VM_GCD \
- rb_vm_set_multithreaded(__mt);
-
static inline uint64_t
number_to_nanoseconds(VALUE num)
{
@@ -332,7 +325,8 @@
VALUE synchronous;
rb_scan_args(argc, argv, "01", &synchronous);
- PRE_VM_GCD
+ rb_vm_set_multithreaded(true);
+
if (RTEST(synchronous)){
dispatch_sync_f(RQueue(self)->queue, (void *)the_block,
rb_queue_dispatcher);
@@ -341,7 +335,6 @@
dispatch_async_f(RQueue(self)->queue, (void *)the_block,
rb_queue_dispatcher);
}
- POST_VM_GCD
return Qnil;
}
@@ -368,10 +361,10 @@
rb_raise(rb_eArgError, "dispatch_after() requires a block argument");
}
- PRE_VM_GCD
+ rb_vm_set_multithreaded(true);
+
dispatch_after_f(offset, RQueue(self)->queue, (void *)the_block,
rb_queue_dispatcher);
- POST_VM_GCD
return Qnil;
}
@@ -406,10 +399,10 @@
rb_raise(rb_eArgError, "apply() requires a block argument");
}
- PRE_VM_GCD
+ rb_vm_set_multithreaded(true);
+
dispatch_apply_f(NUM2SIZET(n), RQueue(self)->queue, (void*)the_block,
rb_queue_applier);
- POST_VM_GCD
return Qnil;
}
@@ -562,10 +555,10 @@
rb_raise(rb_eArgError, "dispatch() requires a block argument");
}
- PRE_VM_GCD
+ rb_vm_set_multithreaded(true);
+
dispatch_group_async_f(RGroup(self)->group, RQueue(target)->queue,
(void *)the_block, rb_queue_dispatcher);
- POST_VM_GCD
return Qnil;
}
@@ -593,10 +586,10 @@
rb_raise(rb_eArgError, "notify() requires a block argument");
}
- PRE_VM_GCD
+ rb_vm_set_multithreaded(true);
+
dispatch_group_notify_f(RGroup(self)->group, RQueue(target)->queue,
(void *)the_block, rb_queue_dispatcher);
- POST_VM_GCD
return Qnil;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090928/fc5f5f3f/attachment.html>
More information about the macruby-changes
mailing list