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]

sem_wait frequently returning with EINTR [Was: Re: How to "bisect" Cygwin?]


> The basic issue is that sem_wait() is being kicked out with EINTR
> extremely frequently (9 out of 10 times or more), which slows my code
> to a crawl as it repeatedly retries sem_wait() until it finally
> returns zero.  In 1.7.9, it does not appear that sem_wait() is
> preempted in this fashion; the thread would simply wait on the
> semaphore until it was sem_post()'d and then continue as expected.

Are you using signals or functions that use signals internally? Signals are
a bit wonky in 1.7.9 and they seem to be pretty much broken in 1.7.12 and
newer (I didnât try any snapshots). Have a look at the problem I reported:
http://cygwin.com/ml/cygwin/2012-05/msg00186.html
While the cancelling part seems to be mostly fixed by now, the signal part
is still unchanged.

Maybe you could try test 3 from my test program attached to the above
mentioned post. If its output changes along with your programâs behaviour
when you try different Cygwin versions, your problem could be signal-related.

Warren Young wrote in http://cygwin.com/ml/cygwin/2012-06/msg00032.html:
> You should just get an infinite series of "Child timed out normally waiting
> for the semaphore." messages from it after initialization, one per second.

This works for me out of the box, but if I create one or more pthreads before
the alarm loop it just fails: Some other thread gets woken up and the main
thread stays stuck in sem_wait.

If Ryan had told us more about his program, weâd know whether he uses multiple
threads or multiple processes...

Cheers,
Otto

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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