Date: Fri, 15 Mar 2002 11:30:53 -0500 From: Brian Dean <bsd@bsdhome.com> To: freebsd-arch@freebsd.org Subject: uthread patch to correct the return code for pthread_rwlock_tryXXlock() Message-ID: <20020315113053.A48681@neutrino.bsdhome.com>
next in thread | raw e-mail | index | archive | help
Hi, The man pages for pthread_rwlock_trywrlock() and pthread_rwlock_tryrdlock() say that EBUSY is returned when the calling thread is not able to aquire the lock without blocking. However, the actual functions return EWOULDBLOCK. I believe the man page is correct (Solaris and others, at least, return EBUSY). Unless there are objections, I plan on committing the attached patch to correct the code. Thanks, -Brian -- Brian Dean bsd@FreeBSD.org bsd@bsdhome.com Index: uthread_rwlock.c =================================================================== RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_rwlock.c,v retrieving revision 1.6 diff -u -r1.6 uthread_rwlock.c --- uthread_rwlock.c 10 Apr 2001 04:19:20 -0000 1.6 +++ uthread_rwlock.c 15 Mar 2002 16:21:54 -0000 @@ -209,7 +209,7 @@ /* give writers priority over readers */ if (prwlock->blocked_writers || prwlock->state < 0) - ret = EWOULDBLOCK; + ret = EBUSY; else if (prwlock->state == MAX_READ_LOCKS) ret = EAGAIN; /* too many read locks acquired */ else @@ -245,7 +245,7 @@ return(ret); if (prwlock->state != 0) - ret = EWOULDBLOCK; + ret = EBUSY; else /* indicate we are locked for writing */ prwlock->state = -1; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020315113053.A48681>