T BlockingQueue<T>::pop( ) {
pthread_mutex_lock(&lock);
if (list.empty( )) {
pthread_cond_wait(&cond) ;
}
T temp = list.front( );
list.pop_front( );
pthread_mutex_unlock(&lock);
return temp;
}
The above is the pop operation as defined for a templatized concurrent blocking queue based on an underlying linked list and pthreads. My question: In what ways could we optimize this code further?