c++ Programming Glossary: inqueuelock
A very simple thread pool using pthreads in C++ http://stackoverflow.com/questions/3561095/a-very-simple-thread-pool-using-pthreads-in-c shared resources pthread_mutex_t coutLock pthread_mutex_t inQueueLock pthread_mutex_t outQueueLock the shared data std list std string.. keep on working until inQueue is empty pthread_mutex_lock inQueueLock std string workOnMe if inQueue.size 0 somethingTodo false else.. inQueue.front inQueue.pop_front pthread_mutex_unlock inQueueLock if somethingTodo break workOnMe thread taskString worked on..
|