@@ -33,7 +33,7 @@ ThreadPool::ThreadPool(unsigned int num_thread)
3333 pthread_mutex_lock (&mutexSync);
3434 _top_index = 0 ;
3535 _bottom_index = 0 ;
36- incompleteWork = 0 ;
36+ _incomplete_work = 0 ;
3737 sem_init (&_available_work, 0 , 0 );
3838 sem_init (&_available_thread, 0 , queueSize);
3939 pthread_mutex_unlock (&mutexSync);
@@ -59,9 +59,9 @@ ThreadPool::~ThreadPool()
5959
6060void ThreadPool::destroyPool (int maxPollSecs = 2 )
6161{
62- while ( incompleteWork >0 )
62+ while ( _incomplete_work >0 )
6363 {
64- // cout << "Work is still incomplete=" << incompleteWork << endl;
64+ // cout << "Work is still incomplete=" << _incomplete_work << endl;
6565 sleep (maxPollSecs);
6666 }
6767 cout << " All Done!! Wow! That was a lot of work!" << endl;
@@ -76,8 +76,8 @@ void ThreadPool::destroyPool(int maxPollSecs = 2)
7676bool ThreadPool::assignWork (WorkerThread *workerThread)
7777{
7878 pthread_mutex_lock (&mutexWorkCompletion);
79- incompleteWork ++;
80- // cout << "assignWork...incomapleteWork=" << incompleteWork << endl;
79+ _incomplete_work ++;
80+ // cout << "assignWork...incomapleteWork=" << _incomplete_work << endl;
8181 pthread_mutex_unlock (&mutexWorkCompletion);
8282
8383 sem_wait (&_available_thread);
@@ -124,7 +124,7 @@ void *ThreadPool::threadExecute(void *param)
124124
125125 pthread_mutex_lock ( &(((ThreadPool *)param)->mutexWorkCompletion ) );
126126 // cout << "Thread " << pthread_self() << " has completed a Job !" << endl;
127- ((ThreadPool *)param)->incompleteWork --;
127+ ((ThreadPool *)param)->_incomplete_work --;
128128 pthread_mutex_unlock ( &(((ThreadPool *)param)->mutexWorkCompletion ) );
129129 }
130130 return 0 ;
0 commit comments