static
void cleanup_after_thread_exited ( ThreadId tid )
{
+ vki_ksigset_t irrelevant_sigmask;
vg_assert(VG_(is_valid_or_empty_tid)(tid));
vg_assert(VG_(threads)[tid].status == VgTs_Empty);
/* Mark its stack no-access */
/* Forget about any pending signals directed specifically at this
thread, and get rid of signal handlers specifically arranged for
this thread. */
+ VG_(block_all_host_signals)( &irrelevant_sigmask );
VG_(handle_SCSS_change)( False /* lazy update */ );
}
VG_(do_pthread_sigmask_SCSS_upd) ( tid, vki_how, newmask, oldmask );
+ if (newmask && VG_(clo_instrument)) {
+ VGM_(make_readable)( (Addr)newmask, sizeof(vki_ksigset_t) );
+ }
+
/* Success. */
SET_EDX(tid, 0);
}
if (VG_(clo_trace_signals))
VG_(message)(Vg_DebugMsg,
- "do_setmask: tid = %d (0 means ALL), how = %d (%s), set = %p",
+ "do_setmask: tid = %d (%d means ALL), how = %d (%s), set = %p",
tid,
+ VG_INVALID_THREADID,
how,
how==VKI_SIG_BLOCK ? "SIG_BLOCK" : (
how==VKI_SIG_UNBLOCK ? "SIG_UNBLOCK" : (
void *report_stats(void *p)
{
- int caught;
+ int caught, i;
sigset_t sigs_to_catch;
/* Identify our thread */
* handle it.
*/
- /* JRS 13 May 2002: this has a race condition, which is obvious if
- you fire SIGUSR1s at it fast enough -- once sigwait returns,
- there is no hander whilst it does the rest of the loop, so if a
- signal arrives then, the program is killed, since that's the
- default action for SIGUSR1. */
-
/* set this thread's signal mask to block out SIGUSR1 */
sigemptyset(&sigs_to_catch);
sigaddset(&sigs_to_catch, SIGUSR1);
mean = total/samples;
printf("\nreport_stats(): mean = %d, samples = %d\n", mean, samples);
pthread_mutex_unlock(&stats_lock);
+
+ /* Delay for a while so it's obvious whether or not SIGUSR1 is
+ still blocked here (it should be). */
+ // for (i = 0; i < 100000; i++) ;
+
}
return NULL;
}
static
void cleanup_after_thread_exited ( ThreadId tid )
{
+ vki_ksigset_t irrelevant_sigmask;
vg_assert(VG_(is_valid_or_empty_tid)(tid));
vg_assert(VG_(threads)[tid].status == VgTs_Empty);
/* Mark its stack no-access */
/* Forget about any pending signals directed specifically at this
thread, and get rid of signal handlers specifically arranged for
this thread. */
+ VG_(block_all_host_signals)( &irrelevant_sigmask );
VG_(handle_SCSS_change)( False /* lazy update */ );
}
VG_(do_pthread_sigmask_SCSS_upd) ( tid, vki_how, newmask, oldmask );
+ if (newmask && VG_(clo_instrument)) {
+ VGM_(make_readable)( (Addr)newmask, sizeof(vki_ksigset_t) );
+ }
+
/* Success. */
SET_EDX(tid, 0);
}
if (VG_(clo_trace_signals))
VG_(message)(Vg_DebugMsg,
- "do_setmask: tid = %d (0 means ALL), how = %d (%s), set = %p",
+ "do_setmask: tid = %d (%d means ALL), how = %d (%s), set = %p",
tid,
+ VG_INVALID_THREADID,
how,
how==VKI_SIG_BLOCK ? "SIG_BLOCK" : (
how==VKI_SIG_UNBLOCK ? "SIG_UNBLOCK" : (