mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread.c (terminate_atfork_i): all mutex locks by other threads
have been abandoned at fork. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4bfd133993
commit
e8c17f1a59
2 changed files with 23 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Nov 18 17:48:22 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* thread.c (terminate_atfork_i): all mutex locks by other threads
|
||||||
|
have been abandoned at fork.
|
||||||
|
|
||||||
Wed Nov 18 15:27:20 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
Wed Nov 18 15:27:20 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (file_path_convert): delay getting filesystem encoding
|
* file.c (file_path_convert): delay getting filesystem encoding
|
||||||
|
|
18
thread.c
18
thread.c
|
@ -323,6 +323,7 @@ typedef struct rb_mutex_struct
|
||||||
} mutex_t;
|
} mutex_t;
|
||||||
|
|
||||||
static void rb_mutex_unlock_all(mutex_t *mutex, rb_thread_t *th);
|
static void rb_mutex_unlock_all(mutex_t *mutex, rb_thread_t *th);
|
||||||
|
static void rb_mutex_abandon_all(mutex_t *mutexes);
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_thread_terminate_all(void)
|
rb_thread_terminate_all(void)
|
||||||
|
@ -2724,6 +2725,10 @@ terminate_atfork_i(st_data_t key, st_data_t val, st_data_t current_th)
|
||||||
GetThreadPtr(thval, th);
|
GetThreadPtr(thval, th);
|
||||||
|
|
||||||
if (th != (rb_thread_t *)current_th) {
|
if (th != (rb_thread_t *)current_th) {
|
||||||
|
if (th->keeping_mutexes) {
|
||||||
|
rb_mutex_abandon_all(th->keeping_mutexes);
|
||||||
|
}
|
||||||
|
th->keeping_mutexes = NULL;
|
||||||
thread_cleanup_func(th);
|
thread_cleanup_func(th);
|
||||||
}
|
}
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
|
@ -3285,6 +3290,19 @@ rb_mutex_unlock_all(mutex_t *mutexes, rb_thread_t *th)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
rb_mutex_abandon_all(mutex_t *mutexes)
|
||||||
|
{
|
||||||
|
mutex_t *mutex;
|
||||||
|
|
||||||
|
while (mutexes) {
|
||||||
|
mutex = mutexes;
|
||||||
|
mutexes = mutex->next_mutex;
|
||||||
|
mutex->th = 0;
|
||||||
|
mutex->next_mutex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_mutex_sleep_forever(VALUE time)
|
rb_mutex_sleep_forever(VALUE time)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue