[macruby-changes] [4402] MacRuby/trunk/vm.cpp
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 3 12:45:52 PDT 2010
Revision: 4402
http://trac.macosforge.org/projects/ruby/changeset/4402
Author: lsansonetti at apple.com
Date: 2010-08-03 12:45:51 -0700 (Tue, 03 Aug 2010)
Log Message:
-----------
when unregistering a thread, mark is as dead very early to avoid pthread mutex lock problems when potentially cancelling it later (fixes #794, patch by watson1978 at gmail.com)
Modified Paths:
--------------
MacRuby/trunk/vm.cpp
Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp 2010-08-03 06:36:29 UTC (rev 4401)
+++ MacRuby/trunk/vm.cpp 2010-08-03 19:45:51 UTC (rev 4402)
@@ -4291,6 +4291,9 @@
{
RoxorCoreLock lock;
+ rb_vm_thread_t *t = GetThreadPtr(thread);
+ t->status = THREAD_DEAD;
+
// We do not call #delete because it might trigger #== in case it has been
// overriden on the thread object, and therefore cause a deadlock if the
// new method tries to acquire the RoxorCore GIL.
@@ -4311,8 +4314,6 @@
lock.unlock();
- rb_vm_thread_t *t = GetThreadPtr(thread);
-
const int code = pthread_mutex_destroy(&t->sleep_mutex);
if (code == EBUSY) {
// The mutex is already locked, which means we are being called from
@@ -4333,8 +4334,6 @@
t->vm = NULL;
pthread_assert(pthread_setspecific(RoxorVM::vm_thread_key, NULL));
-
- t->status = THREAD_DEAD;
}
static inline void
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100803/1d0c397b/attachment.html>
More information about the macruby-changes
mailing list