#include <threadpool.h>
Definition at line 56 of file threadpool.h.
◆ waiter()
| tools::threadpool::waiter::waiter |
( |
| ) |
|
|
inline |
Wait for a set of tasks to finish.
Definition at line 64 of file threadpool.h.
◆ ~waiter()
| tools::threadpool::waiter::~waiter |
( |
| ) |
|
Definition at line 96 of file threadpool.cpp.
97{
98 try
99 {
100 boost::unique_lock<boost::mutex> lock(mt);
101 if (num)
102 MERROR(
"wait should have been called before waiter dtor - waiting now");
103 }
104 catch (...) { }
105 try
106 {
108 }
109 catch (const std::exception &e)
110 {
111
112 }
113}
◆ dec()
| void tools::threadpool::waiter::dec |
( |
| ) |
|
Definition at line 128 of file threadpool.cpp.
128 {
129 const boost::unique_lock<boost::mutex> lock(mt);
130 num--;
131 if (!num)
132 cv.notify_all();
133}
◆ inc()
| void tools::threadpool::waiter::inc |
( |
| ) |
|
Definition at line 123 of file threadpool.cpp.
123 {
124 const boost::unique_lock<boost::mutex> lock(mt);
125 num++;
126}
◆ wait()
| void tools::threadpool::waiter::wait |
( |
threadpool * | tpool | ) |
|
Definition at line 115 of file threadpool.cpp.
115 {
116 if (tpool)
117 tpool->run(true);
118 boost::unique_lock<boost::mutex> lock(mt);
119 while(num)
120 cv.wait(lock);
121}
The documentation for this class was generated from the following files:
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/common/threadpool.h
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/common/threadpool.cpp