equal
deleted
inserted
replaced
|
1 // Copyright (C) 2002-2003 |
|
2 // David Moore, William E. Kempf |
|
3 // |
|
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying |
|
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
|
6 |
|
7 #ifndef BOOST_BARRIER_JDM030602_HPP |
|
8 #define BOOST_BARRIER_JDM030602_HPP |
|
9 |
|
10 #include <boost/thread/detail/config.hpp> |
|
11 |
|
12 #include <boost/thread/mutex.hpp> |
|
13 #include <boost/thread/condition.hpp> |
|
14 |
|
15 namespace boost { |
|
16 |
|
17 class BOOST_THREAD_DECL barrier |
|
18 { |
|
19 public: |
|
20 barrier(unsigned int count); |
|
21 ~barrier(); |
|
22 |
|
23 bool wait(); |
|
24 |
|
25 private: |
|
26 mutex m_mutex; |
|
27 // disable warnings about non dll import |
|
28 // see: http://www.boost.org/more/separate_compilation.html#dlls |
|
29 #ifdef BOOST_MSVC |
|
30 # pragma warning(push) |
|
31 # pragma warning(disable: 4251 4231 4660 4275) |
|
32 #endif |
|
33 condition m_cond; |
|
34 #ifdef BOOST_MSVC |
|
35 # pragma warning(pop) |
|
36 #endif |
|
37 unsigned int m_threshold; |
|
38 unsigned int m_count; |
|
39 unsigned int m_generation; |
|
40 }; |
|
41 |
|
42 } // namespace boost |
|
43 |
|
44 #endif |