| 216 | } |
| 217 | |
| 218 | bool wait() |
| 219 | { |
| 220 | boost::unique_lock < boost::mutex > lock(m_mutex); |
| 221 | unsigned int gen = m_generation; |
| 222 | |
| 223 | if (--m_count == 0) |
| 224 | { |
| 225 | m_generation++; |
| 226 | m_count = static_cast<unsigned int>(fct_()); |
| 227 | BOOST_ASSERT(m_count != 0); |
| 228 | lock.unlock(); |
| 229 | m_cond.notify_all(); |
| 230 | return true; |
| 231 | } |
| 232 | |
| 233 | while (gen == m_generation) |
| 234 | m_cond.wait(lock); |
| 235 | return false; |
| 236 | } |
| 237 | |
| 238 | void count_down_and_wait() |
| 239 | { |
nothing calls this directly
no test coverage detected