зеркало из https://github.com/github/ruby.git
* process.c (struct child_handler_disabler_state): cancelstate field
added. (disable_child_handler_before_fork): Record cancelstate. (disable_child_handler_fork_parent): Restore cancelstate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3de392def9
Коммит
42becbddc2
|
@ -1,3 +1,10 @@
|
|||
Sat Sep 6 20:19:16 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* process.c (struct child_handler_disabler_state): cancelstate field
|
||||
added.
|
||||
(disable_child_handler_before_fork): Record cancelstate.
|
||||
(disable_child_handler_fork_parent): Restore cancelstate.
|
||||
|
||||
Sat Sep 6 19:27:10 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* process.c (struct child_handler_disabler_state): Defined.
|
||||
|
|
13
process.c
13
process.c
|
@ -3382,6 +3382,7 @@ has_privilege(void)
|
|||
struct child_handler_disabler_state
|
||||
{
|
||||
sigset_t sigmask;
|
||||
int cancelstate;
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -3399,6 +3400,12 @@ disable_child_handler_before_fork(struct child_handler_disabler_state *old)
|
|||
errno = ret;
|
||||
rb_sys_fail("pthread_sigmask");
|
||||
}
|
||||
|
||||
ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old->cancelstate);
|
||||
if (ret != 0) {
|
||||
errno = ret;
|
||||
rb_sys_fail("pthread_setcancelstate");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3406,6 +3413,12 @@ disable_child_handler_fork_parent(struct child_handler_disabler_state *old)
|
|||
{
|
||||
int ret;
|
||||
|
||||
ret = pthread_setcancelstate(old->cancelstate, NULL);
|
||||
if (ret != 0) {
|
||||
errno = ret;
|
||||
rb_sys_fail("pthread_setcancelstate");
|
||||
}
|
||||
|
||||
ret = pthread_sigmask(SIG_SETMASK, &old->sigmask, NULL); /* not async-signal-safe */
|
||||
if (ret != 0) {
|
||||
errno = ret;
|
||||
|
|
Загрузка…
Ссылка в новой задаче