00001
#ifndef VERSIONRWLOCK_H
00002
#define VERSIONRWLOCK_H
00003
00004
#include <iostream>
00005
#include <pthread.h>
00006
#include <stdio.h>
00007
00008
#include "common.h"
00009
00010
using namespace Borealis;
00011
00012
00024 class VersionRWLock
00025 {
00026
public:
00030
VersionRWLock();
00031
00035 int32
readVersion();
00036
00042
bool verifyVersion( int32 version );
00043
00047
void writeLock();
00048
00053
void writeUnLock();
00054
00055
private:
00056 pthread_mutex_t mutex;
00057 pthread_cond_t readOK;
00058
00059 int32 _version;
00060 int32 _writers;
00061 };
00062
00063
#endif // VERSIONRWLOCK_H