mirror of
https://github.com/uroni/urbackup_backend.git
synced 2025-10-26 11:36:50 +00:00
39 lines
586 B
C++
39 lines
586 B
C++
#pragma once
|
|
|
|
#include <pthread.h>
|
|
#include "Interface/SharedMutex.h"
|
|
#include <memory>
|
|
|
|
class SharedMutex : public ISharedMutex
|
|
{
|
|
public:
|
|
SharedMutex();
|
|
~SharedMutex();
|
|
|
|
virtual ILock* readLock();
|
|
|
|
virtual ILock* writeLock();
|
|
|
|
private:
|
|
pthread_rwlock_t lock;
|
|
};
|
|
|
|
class ReadLock : public ILock
|
|
{
|
|
public:
|
|
ReadLock(pthread_rwlock_t* read_lock);
|
|
~ReadLock();
|
|
|
|
private:
|
|
pthread_rwlock_t* read_lock;
|
|
};
|
|
|
|
class WriteLock : public ILock
|
|
{
|
|
public:
|
|
WriteLock(pthread_rwlock_t* write_lock);
|
|
~WriteLock();
|
|
|
|
private:
|
|
pthread_rwlock_t* write_lock;
|
|
}; |