]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | // Copyright Oliver Kowalke 2013. | |
3 | // Distributed under the Boost Software License, Version 1.0. | |
4 | // (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
7 | #ifndef BOOST_FIBERS_BARRIER_H | |
8 | #define BOOST_FIBERS_BARRIER_H | |
9 | ||
10 | #include <cstddef> | |
11 | ||
12 | #include <boost/config.hpp> | |
13 | ||
14 | #include <boost/fiber/condition_variable.hpp> | |
15 | #include <boost/fiber/detail/config.hpp> | |
16 | #include <boost/fiber/mutex.hpp> | |
17 | ||
18 | #ifdef BOOST_HAS_ABI_HEADERS | |
19 | # include BOOST_ABI_PREFIX | |
20 | #endif | |
21 | ||
22 | namespace boost { | |
23 | namespace fibers { | |
24 | ||
25 | class BOOST_FIBERS_DECL barrier { | |
26 | private: | |
27 | std::size_t initial_; | |
28 | std::size_t current_; | |
29 | bool cycle_{ true }; | |
30 | mutex mtx_{}; | |
31 | condition_variable cond_{}; | |
32 | ||
33 | public: | |
34 | explicit barrier( std::size_t); | |
35 | ||
36 | barrier( barrier const&) = delete; | |
37 | barrier & operator=( barrier const&) = delete; | |
38 | ||
39 | bool wait(); | |
40 | }; | |
41 | ||
42 | }} | |
43 | ||
44 | #ifdef BOOST_HAS_ABI_HEADERS | |
45 | # include BOOST_ABI_SUFFIX | |
46 | #endif | |
47 | ||
48 | #endif // BOOST_FIBERS_BARRIER_H |