public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: William Ahern <william@25thandClement.com>
To: Ross Johnson <Ross.Johnson@homemail.com.au>
Cc: pthreads-win32@sourceware.org
Subject: Re: sigaction & pthread_sigmask
Date: Fri, 20 Jun 2008 21:39:00 -0000	[thread overview]
Message-ID: <20080620213916.GA24891@wilbur.25thandClement.com> (raw)
In-Reply-To: <485B0ED4.2020909@homemail.com.au>

On Fri, Jun 20, 2008 at 11:58:44AM +1000, Ross Johnson wrote:
<snip>
> Please submit the patch. Send it to me directly if it's large and I will 
> put it up on the FTP site for others to review if they wish.
> 

I punted on per-thread masks (and thus capabilities for pthread_kill(), as
well) because of my particular time constraints in my current project. I
just wanted to be able to call sigwait().

Any advice on safely using thread-local storage, or tolerance for caveats?
I'm concerned about the interrupts arriving before thread-local storage can
be initialized (using the API, as opposed to linker capabilities, the latter
of which I doubt solves the race anyhow). I had initially set out to use STM
(Software Transactional Memory), but my subsequent understanding of the
literature has been that CAS cannot support fixed space STM algorithms (as
opposed to strong LL/SC primitives, which don't exist in the real-world),
but rather require space linear to the number of processes/threads, and thus
dynamic memory. Clearly this poses a problem for async-safety (honestly, I
have no time to try to make DCAS work, and in any event it would fail on
early AMD 64-bit processors, which have no 128-bit CAS operations, and
anything less than 32-bit versioning--because pointers would eat 48 out of
64 bits--isn't exactly a strong solution to the ABA problem.)

I'm inclined to simply document that interrupts which arrive before TLS can
be setup are discarded, and so simply try to grab any per-thread signal mask
from the pthread_t object (I'll need to confirm that TlsGetValue is
lock-free, of course, or make other arrangements). I'm entirely fuzzy on
Microsoft SEH in general, so perhaps there are stronger constraints I can
rely on. (My signal delivery always serializes handler execution, so handler
masks are moot; I wonder if SEH guarantees that anyhow.)

Also, I'll need time to recode my atomic operations and implementations
according to the local code base (including writing
ptw32_InterlockedCompareExchange64; currently I'm using GCC 4.1 intrinsics).
I'll aim for a proper patch by the end of the month or early July. I just
wanted confirmation my time wouldn't necessarily be wasted.

  reply	other threads:[~2008-06-20 21:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19  5:58 William Ahern
2008-06-19 11:52 ` Burkhardt, Glenn
2008-06-19 12:15   ` John E. Bossom
2008-06-19 12:18     ` Burkhardt, Glenn
2008-06-20  1:29     ` Ross Johnson
2008-06-20 11:45       ` Burkhardt, Glenn
2008-06-20 11:48         ` drifting
2008-06-20  1:59 ` Ross Johnson
2008-06-20 21:39   ` William Ahern [this message]
2008-06-21  3:49     ` Ross Johnson
2008-09-13 23:40       ` William Ahern

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=20080620213916.GA24891@wilbur.25thandClement.com \
    --to=william@25thandclement.com \
    --cc=Ross.Johnson@homemail.com.au \
    --cc=pthreads-win32@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).