Skip to content

Commit

Permalink
thread: mask all signals on child threads
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
liewegas committed Mar 9, 2010
1 parent e976c53 commit e4e775b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e4e775b

Please sign in to comment.