Nebula
Loading...
Searching...
No Matches
posixreadwritelock.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
9//------------------------------------------------------------------------------
10#include <pthread.h>
11#include "threading/threadid.h"
12namespace Posix
13{
14
16{
17public:
22
24 void LockRead();
26 void LockWrite();
27
29 void UnlockRead();
31 void UnlockWrite();
32
33private:
34 int32_t readCounter = 0;
35 int32_t writeCounter = 0;
36 pthread_rwlock_t lock;
38};
39
40} // namespace Posix
Definition posixreadwritelock.h:16
int32_t writeCounter
Definition posixreadwritelock.h:35
pthread_rwlock_t lock
Definition posixreadwritelock.h:36
~PosixReadWriteLock()
Destructor.
Definition posixreadwritelock.cc:24
void UnlockRead()
Release read.
Definition posixreadwritelock.cc:61
void LockWrite()
Lock for write.
Definition posixreadwritelock.cc:45
void UnlockWrite()
Release write.
Definition posixreadwritelock.cc:72
Threading::ThreadId lockingThread
Definition posixreadwritelock.h:37
int32_t readCounter
Definition posixreadwritelock.h:34
void LockRead()
Lock for read.
Definition posixreadwritelock.cc:34
PosixReadWriteLock()
Constructor.
Definition posixreadwritelock.cc:15
Posix implemention of a read-many write-few lock.
Definition posixsysfunc.cc:21
pthread_t ThreadId
Definition linuxthreadid.h:15