[macruby-changes] [746] MacRuby/trunk/thread_pthread.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 14 21:36:04 PST 2008


Revision: 746
          http://trac.macosforge.org/projects/ruby/changeset/746
Author:   lsansonetti at apple.com
Date:     2008-11-14 21:36:04 -0800 (Fri, 14 Nov 2008)
Log Message:
-----------
make sure our thread object remains alive from the pthread_create call to our callback (thanks Vincent Isambart for debugging)

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

Modified: MacRuby/trunk/thread_pthread.c
===================================================================
--- MacRuby/trunk/thread_pthread.c	2008-11-14 22:00:34 UTC (rev 745)
+++ MacRuby/trunk/thread_pthread.c	2008-11-15 05:36:04 UTC (rev 746)
@@ -169,6 +169,7 @@
 {
 #if WITH_OBJC
     rb_objc_gc_register_thread();
+    rb_objc_release((void *)th_ptr);
 #endif
 #if USE_THREAD_CACHE
   thread_start:
@@ -327,6 +328,7 @@
 	CHECK_ERR(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED));
 	CHECK_ERR(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED));
 
+	rb_objc_retain((void *)th);
 	err = pthread_create(&th->thread_id, &attr, thread_start_func_1, th);
 	thread_debug("create: %p (%d)", th, err);
 	CHECK_ERR(pthread_attr_destroy(&attr));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20081114/2b827237/attachment-0001.html>


More information about the macruby-changes mailing list