Beamlib 3.1.2
This is the Beam C++ class library.
Loading...
Searching...
No Matches
BRWLock.h
Go to the documentation of this file.
1/*******************************************************************************
2 * BRWLock.h BRWLock Classes
3 * T.Barnaby, BEAM Ltd, 3/07/03
4 * Copyright (c) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5 * For license see LICENSE.txt at the root of the beamlib source tree.
6 *******************************************************************************
7 */
8#ifndef BRWLOCK_H
9#define BRWLOCK_H 1
10
11#include <pthread.h>
12
14class BRWLock {
15public:
16 BRWLock();
17 BRWLock(const BRWLock& rwlock);
18 ~BRWLock();
19
20 int rdLock();
21 int tryRdLock();
22 int wrLock();
23 int tryWrLock();
24 int unlock();
25
26 BRWLock& operator=(const BRWLock& rwlock);
27private:
28 pthread_rwlock_t olock;
29};
30
31#endif
Thread read-write lock.
Definition: BRWLock.h:14
int unlock()
Unlock the lock.
Definition: BRWLock.cpp:42
int tryWrLock()
Test the lock.
Definition: BRWLock.cpp:38
BRWLock & operator=(const BRWLock &rwlock)
Definition: BRWLock.cpp:18
int wrLock()
Set lock, wait if necessary.
Definition: BRWLock.cpp:34
int rdLock()
Set lock, wait if necessary.
Definition: BRWLock.cpp:26
BRWLock()
Definition: BRWLock.cpp:10
~BRWLock()
Definition: BRWLock.cpp:22
int tryRdLock()
Test the lock.
Definition: BRWLock.cpp:30