&uc->uc_stack[uc->uc_stack.size()-1]);
#endif /* PDNS_USE_VALGRIND */
+ ++d_threadsCount;
auto& thread = d_threads[d_maxtid];
auto mt = this;
thread.start = [start, val, mt]() {
}
if(!d_zombiesQueue.empty()) {
d_threads.erase(d_zombiesQueue.front());
+ --d_threadsCount;
d_zombiesQueue.pop();
return true;
}
*/
template<class Key, class Val>bool MTasker<Key,Val>::noProcesses() const
{
- return d_threads.empty();
+ return d_threadsCount == 0;
}
//! returns the number of processes running
*/
template<class Key, class Val>unsigned int MTasker<Key,Val>::numProcesses() const
{
- return d_threads.size();
+ return d_threadsCount;
}
//! gives access to the list of Events threads are waiting for
typedef std::map<int, ThreadInfo> mthreads_t;
mthreads_t d_threads;
+ size_t d_stacksize;
+ size_t d_threadsCount;
int d_tid;
int d_maxtid;
- size_t d_stacksize;
EventVal d_waitval;
enum waitstatusenum {Error=-1,TimeOut=0,Answer} d_waitstatus;
This limit applies solely to the stack, the heap is not limited in any way. If threads need to allocate a lot of data,
the use of new/delete is suggested.
*/
- MTasker(size_t stacksize=16*8192) : d_tid(0), d_maxtid(0), d_stacksize(stacksize), d_waitstatus(Error)
+ MTasker(size_t stacksize=16*8192) : d_stacksize(stacksize), d_threadsCount(0), d_tid(0), d_maxtid(0), d_waitstatus(Error)
{
initMainStackBounds();