Loading...
Searching...
No Matches
pthread_rwlock_t Struct Reference

A fair reader writer lock. More...

Detailed Description

A fair reader writer lock.

The implementation ensures that readers and writers of the same priority won't starve each other. E.g. no new readers will get into the critical section if a writer of the same or a higher priority already waits for the lock.

Definition at line 37 of file pthread_rwlock.h.

#include <pthread_rwlock.h>

Data Fields

int readers
 The current amount of reader inside the critical section.
 
priority_queue_t queue
 Queue of waiting threads.
 
mutex_t mutex
 Provides mutual exclusion on reading and writing on the structure.
 

Field Documentation

◆ mutex

mutex_t pthread_rwlock_t::mutex

Provides mutual exclusion on reading and writing on the structure.

Definition at line 56 of file pthread_rwlock.h.

◆ queue

priority_queue_t pthread_rwlock_t::queue

Queue of waiting threads.

Definition at line 51 of file pthread_rwlock.h.

◆ readers

int pthread_rwlock_t::readers

The current amount of reader inside the critical section.

  • == 0: no thread is in the critical section.
  • > 0: the number of readers currently in the critical section.
  • < 0: a writer is currently in the critical section.

Definition at line 46 of file pthread_rwlock.h.


The documentation for this struct was generated from the following file: