pthread_rwlock: use a mutex for process-private locks.
* instead of a benaphore. * define PTHREAD_RWLOCK_INITIALIZER. * adjust Init(), Destroy(), StructureLock() and StructureUnlock().
This commit is contained in:
@@ -80,6 +80,8 @@ extern "C" {
|
||||
{ PTHREAD_MUTEX_RECURSIVE, 0, -42, -1, 0 }
|
||||
#define PTHREAD_COND_INITIALIZER \
|
||||
{ 0, -42, NULL, 0, 0 }
|
||||
#define PTHREAD_RWLOCK_INITIALIZER \
|
||||
{ 0, -1, {{0}} }
|
||||
|
||||
/* mutex functions */
|
||||
extern int pthread_mutex_destroy(pthread_mutex_t *mutex);
|
||||
|
||||
@@ -105,15 +105,15 @@ struct _pthread_rwlock {
|
||||
__haiku_std_int32 owner;
|
||||
union {
|
||||
struct {
|
||||
__haiku_std_int32 sem;
|
||||
} shared;
|
||||
struct {
|
||||
__haiku_std_int32 lock_sem;
|
||||
__haiku_std_int32 lock_count;
|
||||
__haiku_std_int32 mutex;
|
||||
__haiku_std_int32 unused;
|
||||
__haiku_std_int32 reader_count;
|
||||
__haiku_std_int32 writer_count;
|
||||
void* waiters[2];
|
||||
} local;
|
||||
struct {
|
||||
__haiku_std_int32 sem;
|
||||
} shared;
|
||||
} u;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user