@@ -28,14 +28,14 @@ pthread_mutex_t ThreadPool::mutexWorkCompletion = PTHREAD_MUTEX_INITIALIZER;
2828ThreadPool::ThreadPool (unsigned int num_thread)
2929:_num_thread(num_thread)
3030,_worker_queue(num_thread, NULL )
31- ,queueSize (num_thread)
31+ ,_queue_size (num_thread)
3232{
3333 pthread_mutex_lock (&mutexSync);
3434 _top_index = 0 ;
3535 _bottom_index = 0 ;
3636 _incomplete_work = 0 ;
3737 sem_init (&_available_work, 0 , 0 );
38- sem_init (&_available_thread, 0 , queueSize );
38+ sem_init (&_available_thread, 0 , _queue_size );
3939 pthread_mutex_unlock (&mutexSync);
4040}
4141
@@ -86,8 +86,8 @@ bool ThreadPool::assignWork(WorkerThread *workerThread)
8686 // workerVec[_top_index] = workerThread;
8787 _worker_queue[_top_index] = workerThread;
8888 // cout << "Assigning Worker[" << workerThread->id << "] Address:[" << workerThread << "] to Queue index [" << _top_index << "]" << endl;
89- if (queueSize !=1 )
90- _top_index = (_top_index+1 ) % (queueSize -1 );
89+ if (_queue_size !=1 )
90+ _top_index = (_top_index+1 ) % (_queue_size -1 );
9191 sem_post (&_available_work);
9292 pthread_mutex_unlock (&mutexSync);
9393 return true ;
@@ -101,8 +101,8 @@ bool ThreadPool::fetchWork(WorkerThread **workerArg)
101101 WorkerThread * workerThread = _worker_queue[_bottom_index];
102102 _worker_queue[_bottom_index] = NULL ;
103103 *workerArg = workerThread;
104- if (queueSize !=1 )
105- _bottom_index = (_bottom_index+1 ) % (queueSize -1 );
104+ if (_queue_size !=1 )
105+ _bottom_index = (_bottom_index+1 ) % (_queue_size -1 );
106106 sem_post (&_available_thread);
107107 pthread_mutex_unlock (&mutexSync);
108108 return true ;
0 commit comments