summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-06 11:20:08 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-06 11:20:08 +0000
commit42becbddc24ed347d67e479cccfabcc3404b24ae (patch)
tree937ead9026ae51841a98d6a6b94097810bc540f0 /process.c
parent3de392def964dbacec97d35db7f771669f93f8e5 (diff)
* 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
Diffstat (limited to 'process.c')
-rw-r--r--process.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/process.c b/process.c
index 3733cd0..3d1d0cd 100644
--- a/process.c
+++ b/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;