Fix thread worker unit test so it handles repeat runs (#2479)
This commit is contained in:
parent
9a28d3aec5
commit
5bb6542180
1 changed files with 7 additions and 11 deletions
|
@ -7,19 +7,15 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
std::atomic<bool> passed_sleep{ false };
|
||||
|
||||
void func ()
|
||||
{
|
||||
std::this_thread::sleep_for (std::chrono::seconds (1));
|
||||
passed_sleep = true;
|
||||
}
|
||||
}
|
||||
|
||||
TEST (thread, worker)
|
||||
{
|
||||
std::atomic<bool> passed_sleep{ false };
|
||||
|
||||
auto func = [&passed_sleep]() {
|
||||
std::this_thread::sleep_for (std::chrono::seconds (1));
|
||||
passed_sleep = true;
|
||||
};
|
||||
|
||||
nano::worker worker;
|
||||
worker.push_task (func);
|
||||
ASSERT_FALSE (passed_sleep);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue