Andrew T. Schnable [mailto:[EMAIL PROTECTED]] wrote: > I think all the sem_* functions are broken similarly. [ ... ]
I just came across this myself while working on enabling Cygwin Python threads. You may find the following function helpful: static int fix_status(int status) { return (status == -1) ? errno : status; } I defined it as a routine rather than a macro so that you can use it on a single line without mistakenly calling the function twice. E.g., status = fix_status(sem_wait(thelock)); This should work for any function that returns 0 for success and -1 for failure (putting the error code in errno), since 0 is never a legal errno code. You may find it useful if you are using pthreads and semaphore code at the same time and want the return codes to work the same. -Jerry -O Gerald S. Williams, 22Y-103GA : mailto:[EMAIL PROTECTED] O- -O AGERE SYSTEMS, 555 UNION BLVD : office:610-712-8661 O- -O ALLENTOWN, PA, USA 18109-3286 : mobile:908-672-7592 O- -- 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/