11 lock_guard<mutex> lock(
m_mutex);
20 lock_guard<mutex> lock(
m_mutex);
27 unique_lock<mutex> lock(
m_mutex);
43 lock_guard<mutex> lock(
m_mutex);
53 lock_guard<mutex> lock(
m_mutex);
63 unique_lock<mutex> lock(
m_mutex);
65 m_cv.wait(lock, [
this, nTimes]() {
return m_signal >= nTimes; });
76 cout <<
"Threadpool-Size: " << threadCount << endl;
81 for (
size_t i = 0; i < threadCount; i++)
89 for (
size_t i = 0; i <
m_threads.size(); i++)
92 for (
size_t i = 0; i <
m_threads.size(); i++)
101 function<void()> task;
TaskManager(Application *app)
bool m_signaled
Wheter or not the event is currently signalled.
Configuration & getConfig()
void reset()
Sets the event to unsignaled-mode.
uint m_signal
Wheter or not the event is currently signalled.
uint threadpoolSize() const
void signal()
Sets the event to signaled-mode.
condition_variable m_cv
A condition variable used for synchronization.
vector< thread > m_threads
The thread object for all worker-threads.
manual_reset_event(bool signaled=false)
auto_reset_event m_threadHasTodo
An event that tells workers wheter or not there is a task.
condition_variable m_cv
A condition variable used for synchronization.
void signal()
Sets the event to signaled-mode.
vector< BOOL > m_threadKeepAlive
A a bool for each working-thread that tells it wheter or not to stay alive.
void worker(BOOL *keepAlive)
void signalN(uint n)
Sets the event to signaled-mode (N-times, i.e. to wake up N threads)
mutex m_mutex
A mutex used for synchronization.
void wait(uint nTimes=1)
Wait (block) until the event is set to signaled-mode.
concurrency::concurrent_queue< function< void()> > m_taskqueue
A queue of tasks that needs to be executed.
mutex m_mutex
A mutex used for synchronization.
void wait()
Wait (block) until the event is set to signaled-mode.