Scroom 0.14-48-ga0fee447
Loading...
Searching...
No Matches
threadpool-destruction-tests.cc File Reference
#include <iostream>
#include <memory>
#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"
Include dependency graph for threadpool-destruction-tests.cc:

Functions

const millisec short_timeout (250)
 
const millisec long_timeout (2000)
 
pool schedule (clear(&a)+pass(&b))
 
pool schedule (clear(&c))
 
a P ()
 
boost::thread t (pass(&guard)+destroy(pool))
 
pool reset ()
 
guard V ()
 
 EXPECT_TRUE (t.timed_join(long_timeout))
 
 ASSERT_TRUE (boost::thread::id()==t.get_id())
 
 EXPECT_FALSE (c.P(long_timeout))
 
 EXPECT_TRUE (c.P(long_timeout))
 

Variables

Semaphore guard (0)
 
Semaphore a (0)
 
Semaphore b (0)
 
Semaphore c (0)
 

Function Documentation

◆ ASSERT_TRUE()

ASSERT_TRUE ( boost::thread::id()  = =t.get_id())

◆ EXPECT_FALSE()

EXPECT_FALSE ( c.  Plong_timeout)

◆ EXPECT_TRUE() [1/2]

EXPECT_TRUE ( c.  Plong_timeout)

◆ EXPECT_TRUE() [2/2]

EXPECT_TRUE ( t.  timed_joinlong_timeout)

◆ long_timeout()

const millisec long_timeout ( 2000  )

◆ P()

a P ( )

◆ reset()

pool reset ( )
132{
133 testData.reset();
134
135 return false;
136}
TestData::Ptr testData
Definition test-helpers.cc:25

◆ schedule() [1/2]

pool schedule ( clear &a+pass b)

◆ schedule() [2/2]

pool schedule ( clear c)

◆ short_timeout()

const millisec short_timeout ( 250  )

◆ t()

boost::thread t ( pass &guard destroypool)

◆ V()

guard V ( )

Variable Documentation

◆ a

Semaphore a(0) ( )

◆ b

Semaphore b(0) ( )

◆ c

◆ guard

Semaphore guard ( )
Initial value:
{
static ThreadPool::Ptr create(bool completeAllJobsBeforeDestruction=false)
Definition threadpoolimpl.cc:231
std::shared_ptr< ThreadPool > Ptr
Definition threadpool.hh:165
ThreadPool pool(0)