@@ -34,7 +34,7 @@ ThreadPool::ThreadPool(unsigned int num_thread)
3434 topIndex = 0 ;
3535 bottomIndex = 0 ;
3636 incompleteWork = 0 ;
37- sem_init (&availableWork , 0 , 0 );
37+ sem_init (&_available_work , 0 , 0 );
3838 sem_init (&availableThreads, 0 , queueSize);
3939 pthread_mutex_unlock (&mutexSync);
4040}
@@ -65,7 +65,7 @@ void ThreadPool::destroyPool(int maxPollSecs = 2)
6565 sleep (maxPollSecs);
6666 }
6767 cout << " All Done!! Wow! That was a lot of work!" << endl;
68- sem_destroy (&availableWork );
68+ sem_destroy (&_available_work );
6969 sem_destroy (&availableThreads);
7070 pthread_mutex_destroy (&mutexSync);
7171 pthread_mutex_destroy (&mutexWorkCompletion);
@@ -88,14 +88,14 @@ bool ThreadPool::assignWork(WorkerThread *workerThread)
8888 // cout << "Assigning Worker[" << workerThread->id << "] Address:[" << workerThread << "] to Queue index [" << topIndex << "]" << endl;
8989 if (queueSize !=1 )
9090 topIndex = (topIndex+1 ) % (queueSize-1 );
91- sem_post (&availableWork );
91+ sem_post (&_available_work );
9292 pthread_mutex_unlock (&mutexSync);
9393 return true ;
9494}
9595
9696bool ThreadPool::fetchWork (WorkerThread **workerArg)
9797{
98- sem_wait (&availableWork );
98+ sem_wait (&_available_work );
9999
100100 pthread_mutex_lock (&mutexSync);
101101 WorkerThread * workerThread = _worker_queue[bottomIndex];
0 commit comments