|
Scroom 0.14-49-gb7ae7a6d
|
#include <iostream>#include <boost/date_time/posix_time/posix_time.hpp>#include <boost/thread.hpp>#include <gtest/gtest.h>#include <scroom/function-additor.hh>#include <scroom/semaphore.hh>#include "helpers.hh"
Functions | |
| void | test_count_equals (Semaphore *s, int i) |
| ASSERT_FALSE (s1.try_P()) | |
| ASSERT_TRUE (s2.try_P()) | |
| ASSERT_FALSE (s2.try_P()) | |
| s | V () |
| boost::thread | t (5 *pass(&s)) |
| t | timed_join (millisec(250)) |
| ASSERT_TRUE (success) | |
| if (!success) | |
| ASSERT_FALSE (s.P(millisec(250))) | |
| ASSERT_TRUE (s.P(millisec(250))) | |
Variables | |
| Semaphore | s2 (1) |
| test_count_equals & | s |
| bool const | success = boost::thread::id() == t.get_id() |
| ASSERT_FALSE | ( | s. | Pmillisec(250) | ) |
| ASSERT_FALSE | ( | s1. | try_P() | ) |
| ASSERT_FALSE | ( | s2. | try_P() | ) |
| ASSERT_TRUE | ( | s. | Pmillisec(250) | ) |
| ASSERT_TRUE | ( | s2. | try_P() | ) |
| ASSERT_TRUE | ( | success | ) |
| if | ( | ! | success | ) |
| boost::thread t | ( | 5 *pass & | s | ) |

| t timed_join | ( | millisec(250) | ) |
| s V | ( | ) |
Referenced by test_count_equals().
| Semaphore s2(1) | ( | 1 | ) |
| bool const success = boost::thread::id() == t.get_id() |