--- Mer 4/3/09, Nicholas Sherlock ha scritto: > Da: Nicholas Sherlock > Oggetto: Cygwin PThreads bug? > A: cygwin@cygwin.com > Data: Mercoledì 4 marzo 2009, 02:29 > Hey everyone, > > I'm writing a very thread-intensive application using > Cygwin and Cygwin's PThreads implementation, and I'm > running into a few problems. As far as I can tell from the > spec: > > http://www.opengroup.org/onlinepubs/000095399/functions/pthread_rwlock_rdlock.html > > This C program: > > #include <stdio.h> > #include <pthread.h> > #include <assert.h> > #include <errno.h> > > int main() { > pthread_rwlock_t rw_lock; > > pthread_rwlock_init(&rw_lock,NULL); > > //Lock it once for read... > assert(pthread_rwlock_rdlock(&rw_lock)==0); > > //Lock it again for read... > int err=pthread_rwlock_rdlock(&rw_lock); > > printf("Err %d\n", err); > > assert (err==EAGAIN || err==0); > > if (err!=EAGAIN) > pthread_rwlock_unlock(&rw_lock); > > pthread_rwlock_unlock(&rw_lock); > > pthread_rwlock_destroy(&rw_lock); > > return 0; > } > > Should run correctly. That is, the second call to > pthread_rwlock_rdlock should either succeed (returning > zero), having acquired the read lock a second time, or it > should fail and return EAGAIN, if the number of simultaneous > allowed read locks has been exceeded. It should not fail and > return EDEADLK (45), which it is currently doing. Am I > reading the spec wrong or is Cygwin non-conforming? > > Cheers, > Nicholas Sherlock > > Hi Nicholas,
on $ uname -a CYGWIN_NT-5.1 ITQMOZCAS2NB007 1.7.0(0.200/5/3) 2009-02-20 17:20 i686 Cygwin compiled with gcc-4 $ ./pthread.exe Err 0 Regards Marco Passa a Yahoo! Mail. La webmail che ti offre GRATIS spazio illimitato, antispam e messenger integrato. http://it.mail.yahoo.com/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/