X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Message-ID: <4FC93D36.10206@sister-shadow.de> Date: Sat, 02 Jun 2012 00:07:50 +0200 From: Otto Meta Reply-To: cygwin AT cygwin DOT com User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: nemesis AT icequake DOT net CC: cygwin AT cygwin DOT com Subject: sem_wait frequently returning with EINTR [Was: Re: How to "bisect" Cygwin?] References: <20120531210143 DOT GA11744 AT localhost DOT localdomain> <20120601174610 DOT GD25227 AT localhost DOT localdomain> <20120601181852 DOT GF28506 AT calimero DOT vinschen DOT de> <20120601184041 DOT GE25227 AT localhost DOT localdomain> <20120601185906 DOT GG28506 AT calimero DOT vinschen DOT de> <20120601195107 DOT GF25227 AT localhost DOT localdomain> In-Reply-To: <20120601195107.GF25227@localhost.localdomain> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com > 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