|
Scroom 0.14-48-ga0fee447
|
#include <scroom/threadpool.hh>#include <memory>#include <boost/date_time/posix_time/posix_time.hpp>#include <boost/thread.hpp>#include <boost/thread/future.hpp>#include <gtest/gtest.h>#include <scroom/function-additor.hh>#include <scroom/semaphore.hh>#include "helpers.hh"
Classes | |
| class | A |
| class | B< R > |
Variables | |
| ThreadPool | pool (0) |
| Semaphore | low (0) |
| const int | expected = 2 |
| Semaphore | a (0) |
| pool add | ( | ) |
| EXPECT_EQ | ( | 42 | , |
| result. | get() | ||
| ) |
| EXPECT_EQ | ( | false | , |
| result. | get() | ||
| ) |
| EXPECT_FALSE | ( | a. | Pshort_timeout | ) |
| EXPECT_FALSE | ( | high. | Pshort_timeout | ) |
| EXPECT_FALSE | ( | result. | is_ready() | ) |
| EXPECT_FALSE | ( | s. | Plong_timeout | ) |
| EXPECT_TRUE | ( | a. | Plong_timeout | ) |
| EXPECT_TRUE | ( | has_exactly_n_threads &, | 0pool | ) |
| EXPECT_TRUE | ( | has_exactly_n_threads(t.get(), 1) | ) |
| EXPECT_TRUE | ( | has_exactly_n_threads(t.get(), expected) | ) |
| EXPECT_TRUE | ( | high. | Plong_timeout | ) |
| EXPECT_TRUE | ( | s. | Plong_timeout | ) |
| bool has_at_least_n_threads | ( | ThreadPool * | pool, |
| int | count_ | ||
| ) |
Referenced by has_exactly_n_threads().


| bool has_exactly_n_threads | ( | ThreadPool * | pool, |
| int | count | ||
| ) |

| const millisec long_timeout | ( | 2000 | ) |
| R no_op | ( | Semaphore * | s, |
| R | result | ||
| ) |
| boost::unique_future< bool > result | ( | pool.schedule< bool, B< bool > > | B< bool >::create(&a, false) | ) |
| boost::unique_future< int > result | ( | pool.schedule< int > | [pa=&a] { return no_op(pa, 42);} | ) |
| pool schedule | ( | clear & | low, |
| PRIO_NORMAL | |||
| ) |
| const millisec short_timeout | ( | 250 | ) |
| Semaphore a(0) | ( | 0 | ) |
| expected = 2 |
| ThreadPool pool(0) | ( | 0 | ) |
Referenced by has_at_least_n_threads(), and has_exactly_n_threads().