Files
privacore-open-source-searc…/GbRWLock.h
2017-06-06 17:15:48 +02:00

34 lines
523 B
C++

#ifndef GB_GBRWLOCK_H
#define GB_GBRWLOCK_H
#include <pthread.h>
class GbRWLock {
public:
GbRWLock();
~GbRWLock();
void readLock();
void writeLock();
void readUnlock();
void writeUnlock();
void verify_is_locked();
void verify_is_read_locked();
void verify_is_write_locked();
private:
GbRWLock(const GbRWLock&);
GbRWLock& operator=(const GbRWLock&);
pthread_rwlock_t m_rwlock;
#ifdef DEBUG_RWLOCKS
struct gbrwlock_counter_t* getCounter();
pthread_key_t m_counter_key;
#endif
};
#endif //GB_GBRWLOCK_H