This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unexpected EINVAL from pthread_join

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
> > 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

Attachment: pgp8Z7d2W4vr3.pgp
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]