Rev | Line | |
---|
[12] | 1 | // Copyright (C) 2002-2003 |
---|
| 2 | // David Moore, William E. Kempf |
---|
| 3 | // |
---|
| 4 | // Permission to use, copy, modify, distribute and sell this software |
---|
| 5 | // and its documentation for any purpose is hereby granted without fee, |
---|
| 6 | // provided that the above copyright notice appear in all copies and |
---|
| 7 | // that both that copyright notice and this permission notice appear |
---|
| 8 | // in supporting documentation. William E. Kempf makes no representations |
---|
| 9 | // about the suitability of this software for any purpose. |
---|
| 10 | // It is provided "as is" without express or implied warranty. |
---|
| 11 | |
---|
| 12 | #ifndef BOOST_BARRIER_JDM030602_HPP |
---|
| 13 | #define BOOST_BARRIER_JDM030602_HPP |
---|
| 14 | |
---|
| 15 | #include <boost/thread/detail/config.hpp> |
---|
| 16 | |
---|
| 17 | #include <boost/thread/mutex.hpp> |
---|
| 18 | #include <boost/thread/condition.hpp> |
---|
| 19 | |
---|
| 20 | namespace boost { |
---|
| 21 | |
---|
| 22 | class BOOST_THREAD_DECL barrier |
---|
| 23 | { |
---|
| 24 | public: |
---|
| 25 | barrier(unsigned int count); |
---|
| 26 | ~barrier(); |
---|
| 27 | |
---|
| 28 | bool wait(); |
---|
| 29 | |
---|
| 30 | private: |
---|
| 31 | mutex m_mutex; |
---|
| 32 | condition m_cond; |
---|
| 33 | unsigned int m_threshold; |
---|
| 34 | unsigned int m_count; |
---|
| 35 | unsigned int m_generation; |
---|
| 36 | }; |
---|
| 37 | |
---|
| 38 | } // namespace boost |
---|
| 39 | |
---|
| 40 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.