diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-10 06:49:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-10 06:49:15 +0000 |
commit | 4ba0fe5fd3d12f9918cc84302239bf0e978844a2 (patch) | |
tree | 27ec5243511847068a9cf5eb077c1368f95606a4 | |
parent | 9689308994d3d5537dfc8b798a76c757c283d6ad (diff) |
* thread_pthread.c (native_mutex_reinitialize_atfork): release and
re-acquire the lock at re-initialization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | bootstraptest/test_thread.rb | 6 | ||||
-rw-r--r-- | thread_pthread.c | 5 |
3 files changed, 14 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Thu Dec 10 15:49:13 2009 Nobuyoshi Nakada <[email protected]> + + * thread_pthread.c (native_mutex_reinitialize_atfork): release and + re-acquire the lock at re-initialization. + Thu Dec 10 12:56:02 2009 NARUSE, Yui <[email protected]> * encoding.c (enc_replicate): add Encoding#replicate(name). diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb index 446c9ff4d2..5fdb66bb68 100644 --- a/bootstraptest/test_thread.rb +++ b/bootstraptest/test_thread.rb @@ -434,4 +434,8 @@ assert_finish 3, %q{ Process.waitpid(pid) rescue NotImplementedError end -}, '[ruby-core:26361]' +}, '[ruby-core:23572]' + +assert_equal 'ok', %q{ + Process.waitpid2(fork {sleep 1})[1].success? ? 'ok' : 'ng' +} diff --git a/thread_pthread.c b/thread_pthread.c index 6d011b81be..af0b28644a 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -71,7 +71,10 @@ native_mutex_initialize(pthread_mutex_t *lock) } } -#define native_mutex_reinitialize_atfork(lock) native_mutex_initialize(lock) +#define native_mutex_reinitialize_atfork(lock) (\ + native_mutex_unlock(lock), \ + native_mutex_initialize(lock), \ + native_mutex_lock(lock)) static void native_mutex_destroy(pthread_mutex_t *lock) |