// worker thread is a thread that wait work in the work queue WorkerThread * WorkerThread::Create(pthread_attr_t *attr) { WorkerThread *worker; if((worker = new (std::nothrow)WorkerThread(attr)) == NULL) { errno = ENOMEM; return (NULL); } worker->CreateWorker(); return (worker); }
void WorkerThread::WorkerCleanup(void *param) { WorkerThread *worker = (WorkerThread *)param; if (worker->m_worker_flags & WORKER_DESTROY) { pthread_cond_broadcast(&worker->m_worker_workcv); } else { worker->CreateWorker(); } pthread_mutex_unlock(&worker->m_worker_mutex); }