Cygwin: add init_cygheap::compute_sigblkmask method

Add method to compute process-wide signal block mask

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2022-03-01 16:13:20 +01:00
parent 9551e617e7
commit 05e7a60dd7
2 changed files with 19 additions and 0 deletions

View File

@ -737,6 +737,24 @@ init_cygheap::find_tls (int sig, bool& issig_wait)
return t;
}
sigset_t
init_cygheap::compute_sigblkmask ()
{
sigset_t ret_mask = -1;
tls_sentry here (INFINITE);
int ix = -1;
/* Scan thread list looking for valid signal-receiving threads */
while (++ix < (int) nthreads)
{
/* Only pthreads have tid set to non-0. */
if (threadlist[ix].thread->tid && threadlist[ix].thread->initialized)
ret_mask &= threadlist[ix].thread->sigmask;
}
return ret_mask;
}
/* Called from profil.c to sample all non-main thread PC values for profiling */
extern "C" void
cygheap_profthr_all (void (*profthr_byhandle) (HANDLE))

View File

@ -590,6 +590,7 @@ struct init_cygheap: public mini_cygheap
HANDLE __reg3 remove_tls (_cygtls *);
threadlist_t __reg2 *find_tls (_cygtls *);
threadlist_t __reg3 *find_tls (int, bool&);
sigset_t compute_sigblkmask ();
void unlock_tls (threadlist_t *t) { if (t) ReleaseMutex (t->mutex); }
};