xenium
Loading...
Searching...
No Matches
acquire_guard.hpp
1//
2// Copyright (c) 2018-2020 Manuel Pöter.
3// Licensed under the MIT License. See LICENSE file in the project root for full license information.
4//
5
6#ifndef XENIUM_ACQUIRE_GUARD_HPP
7#define XENIUM_ACQUIRE_GUARD_HPP
8
9#include <atomic>
10
11namespace xenium {
12
20template <typename ConcurrentPtr>
21auto acquire_guard(ConcurrentPtr& p, std::memory_order order = std::memory_order_seq_cst)
22{
23 typename ConcurrentPtr::guard_ptr guard;
24 guard.acquire(p, order);
25 return guard;
26}
27
28}
29
30#endif