2 * Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
20 * Wrapper around an urcu read lock which satisfies the 'Mutex' named
21 * requirements of C++11. Satisfying those requirements facilitates the use of
22 * standard concurrency support library facilities.
24 * read_lock is under the details namespace since it is unlikely to be used
25 * directly by exception-safe code. See read_lock_guard.
29 read_lock() = default;
31 /* "Not copyable" and "not moveable" Mutex requirements. */
32 read_lock(read_lock const &) = delete;
33 read_lock &operator=(read_lock const &) = delete;
51 } /* namespace details */
54 * Provides the basic concept of std::lock_guard for rcu reader locks.
56 * The RCU reader lock is held for the duration of lock_guard's lifetime.
58 class read_lock_guard {
60 read_lock_guard() : _guard(_lock)
64 read_lock_guard(const read_lock_guard &) = delete;
67 details::read_lock _lock;
68 std::lock_guard<details::read_lock> _guard;
71 using unique_read_lock = std::unique_lock<details::read_lock>;
73 } /* namespace urcu */
74 } /* namespace lttng */
76 #endif /* LTTNG_URCU_H */