Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <005d01c1be6d$b9c6a2c0$6401a8c0@dopeslap2k> From: "Andrew T. Schnable" To: Subject: sem_trywait returns EAGAIN (rather than returning -1 and setting errno) Date: Mon, 25 Feb 2002 21:31:41 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Greetings, I was doing some pthreads/semaphore work and I tracked down a problem in my code to a bug in sem_trywait. Posix sem_trywait is defined as returning -1 and setting errno to EAGAIN if the semaphore would have blocked. The cygwin implementation returns EAGAIN an leaves errno unchanged. Has anyone else encountered this problem and provided a fix? Andy schnable AT enteract DOT com PS. The problem seems to be in thread.cc (semaphore::TryWait) - I don't see much stderr setting anywhere in this file - is this verboten - or just overlooked? int semaphore::TryWait () { /*FIXME: signals should be able to interrupt semaphores... *We probably need WaitForMultipleObjects here. */ if (WaitForSingleObject (win32_obj_id, 0) == WAIT_TIMEOUT) return EAGAIN; currentvalue--; return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/