mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
thread.c: reset waitq of keeping mutexes in child
We must not maintain references to threads in the parent process
in any mutexes held by the child process.
* thread_sync.c (rb_mutex_cleanup_keeping_mutexes): new function
* thread.c (rb_thread_atfork): cleanup keeping mutexes
[ruby-core:85940] [Bug #14578]
Fixes: r58604 (commit 3586c9e087
)
("reduce rb_mutex_t size from 160 to 80 bytes on 64-bit")
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4f125262f4
commit
1b455428d3
3 changed files with 26 additions and 0 deletions
|
@ -415,6 +415,20 @@ rb_mutex_abandon_all(rb_mutex_t *mutexes)
|
|||
list_head_init(&mutex->waitq);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* All other threads are dead in the a new child process, so waitqs
|
||||
* contain references to dead threads which we need to clean up
|
||||
*/
|
||||
static void
|
||||
rb_mutex_cleanup_keeping_mutexes(const rb_thread_t *current_thread)
|
||||
{
|
||||
rb_mutex_t *mutex = current_thread->keeping_mutexes;
|
||||
while (mutex) {
|
||||
list_head_init(&mutex->waitq);
|
||||
mutex = mutex->next_mutex;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue