From e4e775b60f117ba2d07da9e0e438714b409447b6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Mar 2010 15:02:30 -0800 Subject: [PATCH] thread: mask all signals on child threads Mask all signals on any threads we create. Since we don't use signals for anything, this leaves the signal behavior to the original parent thread or process linking in librados or libceph. --- src/common/Thread.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/Thread.h b/src/common/Thread.h index 0cab652b977b..0950cd57fbcc 100644 --- a/src/common/Thread.h +++ b/src/common/Thread.h @@ -56,7 +56,12 @@ class Thread { } int create() { _num_threads.inc(); - int r = pthread_create( &thread_id, NULL, _entry_func, (void*)this ); + // mask signals in child's thread + sigset_t newmask, oldmask; + sigfillset(&newmask); + pthread_sigmask(SIG_BLOCK, &newmask, &oldmask); + int r = pthread_create(&thread_id, NULL, _entry_func, (void*)this); + pthread_sigmask(SIG_SETMASK, &oldmask, 0); generic_dout(10) << "thread " << thread_id << " start" << dendl; return r; } -- 2.47.3