ChimeraTK-DeviceAccess
03.26.00
Loading...
Searching...
No Matches
CountedRecursiveMutex.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2
// SPDX-License-Identifier: LGPL-3.0-or-later
3
#pragma once
4
5
#include <atomic>
6
#include <mutex>
7
8
namespace
ChimeraTK::detail {
9
10
class
CountedRecursiveMutex :
public
std::recursive_mutex {
11
public
:
12
CountedRecursiveMutex() =
default
;
13
14
void
lock();
15
void
unlock();
16
bool
try_lock();
17
18
// This count is only reliable when holding the lock.
19
[[nodiscard]]
size_t
useCount()
const
;
20
21
private
:
22
std::atomic<size_t> _useCount{0};
23
};
24
25
}
// namespace ChimeraTK::detail
sources
ChimeraTK-DeviceAccess
include
CountedRecursiveMutex.h
Generated by
1.9.8