| 1 | // Copyright 2023 Peter Dimov |
|---|---|
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // https://www.boost.org/LICENSE_1_0.txt |
| 4 | |
| 5 | #include <boost/unordered/detail/foa/rw_spinlock.hpp> |
| 6 | #include <mutex> |
| 7 | |
| 8 | using boost::unordered::detail::foa::rw_spinlock; |
| 9 | |
| 10 | // Sanity check only |
| 11 | |
| 12 | static rw_spinlock sp; |
| 13 | static rw_spinlock sp2; |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | sp.lock(); |
| 18 | sp2.lock(); |
| 19 | sp.unlock(); |
| 20 | sp2.unlock(); |
| 21 | |
| 22 | { |
| 23 | std::lock_guard<rw_spinlock> lock( sp ); |
| 24 | std::lock_guard<rw_spinlock> lock2( sp2 ); |
| 25 | } |
| 26 | } |
| 27 |
