From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id A849C3858421; Tue, 1 Mar 2022 15:24:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A849C3858421 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: add init_cygheap::compute_sigblkmask method X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 9551e617e742cc8995a8486c3c3687d30a1207b4 X-Git-Newrev: 05e7a60dd7fac7efd1ac792d45377d6971b55e23 Message-Id: <20220301152435.A849C3858421@sourceware.org> Date: Tue, 1 Mar 2022 15:24:35 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2022 15:24:35 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D05e7a60dd7f= ac7efd1ac792d45377d6971b55e23 commit 05e7a60dd7fac7efd1ac792d45377d6971b55e23 Author: Corinna Vinschen Date: Tue Mar 1 16:13:20 2022 +0100 Cygwin: add init_cygheap::compute_sigblkmask method =20 Add method to compute process-wide signal block mask =20 Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/cygheap.cc | 18 ++++++++++++++++++ winsup/cygwin/cygheap.h | 1 + 2 files changed, 19 insertions(+) diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 01b49468e..1be7f0c32 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -737,6 +737,24 @@ init_cygheap::find_tls (int sig, bool& issig_wait) return t; } =20 +sigset_t +init_cygheap::compute_sigblkmask () +{ + sigset_t ret_mask =3D -1; + + tls_sentry here (INFINITE); + + int ix =3D -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 &=3D threadlist[ix].thread->sigmask; + } + return ret_mask; +} + /* Called from profil.c to sample all non-main thread PC values for profil= ing */ extern "C" void cygheap_profthr_all (void (*profthr_byhandle) (HANDLE)) diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index 252dd414d..a47d9819e 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -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); } };