mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-22 17:54:52 +00:00
Fix the return code from pthread_rwlock_try[rw|rd]lock() functions;
these should return EBUSY when the calling thread would block. MFC after: 2 weeks
This commit is contained in:
parent
f303d23186
commit
b18ae9245d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92360
|
@ -209,7 +209,7 @@ _pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
|
|||
|
||||
/* 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 @@ _pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
|
|||
return(ret);
|
||||
|
||||
if (prwlock->state != 0)
|
||||
ret = EWOULDBLOCK;
|
||||
ret = EBUSY;
|
||||
else
|
||||
/* indicate we are locked for writing */
|
||||
prwlock->state = -1;
|
||||
|
|
|
@ -209,7 +209,7 @@ _pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
|
|||
|
||||
/* 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 @@ _pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
|
|||
return(ret);
|
||||
|
||||
if (prwlock->state != 0)
|
||||
ret = EWOULDBLOCK;
|
||||
ret = EBUSY;
|
||||
else
|
||||
/* indicate we are locked for writing */
|
||||
prwlock->state = -1;
|
||||
|
|
|
@ -209,7 +209,7 @@ _pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
|
|||
|
||||
/* 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 @@ _pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
|
|||
return(ret);
|
||||
|
||||
if (prwlock->state != 0)
|
||||
ret = EWOULDBLOCK;
|
||||
ret = EBUSY;
|
||||
else
|
||||
/* indicate we are locked for writing */
|
||||
prwlock->state = -1;
|
||||
|
|
Loading…
Reference in a new issue