this allows sys/types.h to provide the pthread types, as required by POSIX. this design also facilitates forcing ABI-compatible sizes in the arch-specific alltypes.h, while eliminating the need for developers changing the internals of the pthread types to poke around with arch-specific headers they may not be able to test.
13 lines
291 B
C
13 lines
291 B
C
#include "pthread_impl.h"
|
|
|
|
int pthread_rwlock_wrlock(pthread_rwlock_t *rw)
|
|
{
|
|
int nr;
|
|
while (pthread_rwlock_trywrlock(rw)==EAGAIN) {
|
|
if ((nr=rw->_rw_readers))
|
|
__wait(&rw->_rw_readers, &rw->_rw_waiters, nr, 0);
|
|
else
|
|
__wait(&rw->_rw_wrlock, &rw->_rw_waiters, 1, 0);
|
|
}
|
|
return 0;
|
|
}
|