void run () { TScopedLock del_lock( _del_mutex ); while ( ! _end ) { _pool->append_idle( this ); { TScopedLock work_lock( _work_cond ); while (( _job == NULL ) && ! _end ) _work_cond.wait(); } if ( _job != NULL ) { _job->run( _data_ptr ); _job->unlock(); if ( _del_job ) delete _job; TScopedLock work_lock( _work_cond ); _job = NULL; _data_ptr = NULL; } } }
void run () { _del_mutex.lock(); while ( ! _end ) { _pool->append_idle( this ); _work_cond.lock(); while (( _job == NULL ) && ! _end ) _work_cond.wait(); _work_cond.unlock(); if ( _job != NULL ) { _job->run( _data_ptr ); _job->unlock(); if ( _del_job ) delete _job; _work_cond.lock(); _job = NULL; _data_ptr = NULL; _work_cond.unlock(); } } _del_mutex.unlock(); }