34 lines
450 B
C++

// Copyright (C) 2003 Intel Corporation
#ifndef _RW_LOCK_H_
#define _RW_LOCK_H_
#include "Semaphore.h"
class RWLock {
public:
enum RWMode {
READ_ONLY,
READ_WRITE
};
RWLock();
~RWLock() {}
void acquire(const RWMode mode_p = READ_ONLY);
void release();
void switch2RO();
private:
Semaphore _readSem;
Semaphore _writeSem;
Semaphore _countSem;
unsigned int _counter;
};
#endif //_RW_LOCK_H_