[macruby-changes] [4455] MacRuby/trunk/thread.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 23 18:44:59 PDT 2010


Revision: 4455
          http://trac.macosforge.org/projects/ruby/changeset/4455
Author:   lsansonetti at apple.com
Date:     2010-08-23 18:44:59 -0700 (Mon, 23 Aug 2010)
Log Message:
-----------
don't allow a Thread object to be initialized twice

Modified Paths:
--------------
    MacRuby/trunk/thread.c

Modified: MacRuby/trunk/thread.c
===================================================================
--- MacRuby/trunk/thread.c	2010-08-24 01:33:32 UTC (rev 4454)
+++ MacRuby/trunk/thread.c	2010-08-24 01:44:59 UTC (rev 4455)
@@ -43,6 +43,7 @@
 thread_s_alloc(VALUE rcv, SEL sel)
 {
     rb_vm_thread_t *t = (rb_vm_thread_t *)xmalloc(sizeof(rb_vm_thread_t));
+    t->thread = 0;
     return Data_Wrap_Struct(rb_cThread, NULL, NULL, t);
 }
 
@@ -56,6 +57,9 @@
     assert(b != NULL);
 
     rb_vm_thread_t *t = GetThreadPtr(thread);
+    if (t->thread != 0) {
+	rb_raise(rb_eThreadError, "already initialized thread");
+    }
     rb_vm_thread_pre_init(t, b, argc, argv, rb_vm_create_vm());
 
     // The thread's group is always the parent's one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100823/52f388eb/attachment.html>


More information about the macruby-changes mailing list