public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: add init_cygheap::compute_sigblkmask method
Date: Tue,  1 Mar 2022 15:24:35 +0000 (GMT)	[thread overview]
Message-ID: <20220301152435.A849C3858421@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=05e7a60dd7fac7efd1ac792d45377d6971b55e23

commit 05e7a60dd7fac7efd1ac792d45377d6971b55e23
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue Mar 1 16:13:20 2022 +0100

    Cygwin: add init_cygheap::compute_sigblkmask method
    
    Add method to compute process-wide signal block mask
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

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;
 }
 
+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))
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); }
 };


                 reply	other threads:[~2022-03-01 15:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220301152435.A849C3858421@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).