Unexpected EINVAL from pthread_join

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Feb 24 19:58:00 GMT 2015

On Feb 24 15:54, Lasse Collin wrote:
> On 2015-02-23 Corinna Vinschen wrote:
> > On second thought, this is not the right way to handle this.  The
> > WAIT_SIGNALED is returned because we're in the main thread and
> > SA_RESTART is not set, as you assumed above.  This leads to the
> > question why this scenario isn't handled directly in cygwait.
> > 
> > So what I did now is to apply the below patch to CVS.  It adds a flag
> > cw_sig_restart to cygwait, which also restarts in the main thread if
> > SA_RESTART is not set, as it's supposed to be for pthread_join.
> > 
> > I uploaded a new developer snapshot to https://cygwin.com/snapshots/
> > Can you please test if it works as desired?
> The snapshot 20150223 works. (The earlier patch worked too.) Thank you.

Good to read that, thanks!

> Many other pthread functions are similar in sense that they must never
> return EINTR. A bug similar to the one in pthread::join exist in
> pthread_mutex::lock. If SA_RESTART isn't used, signals can make
> multiple threads get a lock on the same mutex at the same time. A test
> program is attached. Adding cw_sig_restart to the cygwait call in
> pthread_mutex::lock fixes this.

Can you collect the info which functions are affected so that lazy me
just has to apply the cw_sig_restart patches in bulk?


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150224/2740efa7/attachment.sig>

More information about the Cygwin mailing list