[macruby-changes] [2396] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Aug 26 19:17:32 PDT 2009
Revision: 2396
http://trac.macosforge.org/projects/ruby/changeset/2396
Author: lsansonetti at apple.com
Date: 2009-08-26 19:17:28 -0700 (Wed, 26 Aug 2009)
Log Message:
-----------
testing thread cancelability is all loops wasn't a bright idea
Modified Paths:
--------------
MacRuby/trunk/vm.h
MacRuby/trunk/vm_eval.c
Modified: MacRuby/trunk/vm.h
===================================================================
--- MacRuby/trunk/vm.h 2009-08-27 01:51:40 UTC (rev 2395)
+++ MacRuby/trunk/vm.h 2009-08-27 02:17:28 UTC (rev 2396)
@@ -407,10 +407,11 @@
void rb_vm_set_current_exception(VALUE exception);
VALUE rb_vm_backtrace(int level);
+#define TEST_THREAD_CANCEL() (pthread_testcancel())
+
VALUE rb_vm_pop_broken_value(void);
#define RETURN_IF_BROKEN() \
do { \
- pthread_testcancel(); \
VALUE __v = rb_vm_pop_broken_value(); \
if (__v != Qundef) { \
return __v; \
Modified: MacRuby/trunk/vm_eval.c
===================================================================
--- MacRuby/trunk/vm_eval.c 2009-08-27 01:51:40 UTC (rev 2395)
+++ MacRuby/trunk/vm_eval.c 2009-08-27 02:17:28 UTC (rev 2396)
@@ -248,9 +248,14 @@
static VALUE
loop_i(void)
{
+ int count = 0;
for (;;) {
rb_yield(Qundef);
RETURN_IF_BROKEN();
+ if (++count < 100) {
+ TEST_THREAD_CANCEL();
+ count = 0;
+ }
}
return Qnil;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090826/b99b1cf0/attachment.html>
More information about the macruby-changes
mailing list