28 #include <sys/cdefs.h>
57 #define RWSEM_INITIALIZER { 1, 0, NULL, NULL }
int initialized
Are we initialized?
Definition: rwsem.h:44
int rwsem_write_lock(rw_semaphore_t *s)
Lock a reader/writer semaphore for writing.
kthread_t * write_lock
The thread holding the write lock.
Definition: rwsem.h:50
int rwsem_read_lock_timed(rw_semaphore_t *s, int timeout)
Lock a reader/writer semaphore for reading (with a timeout).
int rwsem_write_unlock(rw_semaphore_t *s)
Unlock a reader/writer semaphore from a write lock.
int rwsem_unlock(rw_semaphore_t *s)
Unlock a reader/writer semaphore.
rw_semaphore_t * rwsem_create() __attribute__((deprecated))
Allocate a reader/writer semaphore.
int rwsem_read_upgrade(rw_semaphore_t *s)
Upgrade a thread from reader status to writer status.
int rwsem_read_upgrade_timed(rw_semaphore_t *s, int timeout)
Upgrade a thread from reader status to writer status (with a timeout).
int read_count
The number of readers that are currently holding the lock.
Definition: rwsem.h:47
int rwsem_read_unlock(rw_semaphore_t *s)
Unlock a reader/writer semaphore from a read lock.
int rwsem_write_lock_timed(rw_semaphore_t *s, int timeout)
Lock a reader/writer semaphore for writing (with a timeout).
struct rw_semaphore rw_semaphore_t
Reader/writer semaphore structure.
int rwsem_init(rw_semaphore_t *s)
Initialize a reader/writer semaphore.
int rwsem_read_tryupgrade(rw_semaphore_t *s)
Attempt to upgrade a thread from reader status to writer status.
int rwsem_destroy(rw_semaphore_t *s)
Destroy a reader/writer semaphore.
int rwsem_read_lock(rw_semaphore_t *s)
Lock a reader/writer semaphore for reading.
int rwsem_write_trylock(rw_semaphore_t *s)
Attempt to lock a reader/writer semaphore for writing.
Reader/writer semaphore structure.
Definition: rwsem.h:42
Structure describing one running thread.
Definition: thread.h:90
int rwsem_read_count(rw_semaphore_t *s)
Read the reader count on the reader/writer semaphore.
int rwsem_write_locked(rw_semaphore_t *s)
Read the state of the writer lock on the reader/writer semaphore.
kthread_t * reader_waiting
Space for one reader who's trying to upgrade to a writer.
Definition: rwsem.h:53
int rwsem_read_trylock(rw_semaphore_t *s)
Attempt to lock a reader/writer semaphore for reading.