Example #1
0
    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();
	}
Example #2
0
    void quit ()
	{
	    _work_cond.lock();

	    _end      = true;
	    _job      = NULL;
	    _data_ptr = NULL;

	    _work_cond.signal();
	    _work_cond.unlock();
	}
Example #3
0
    void run_job  ( TThreadPool::TJob * j, void * p, const bool del = false )
	{
	    _work_cond.lock();

	    _job      = j;
	    _data_ptr = p;
	    _del_job  = del;

	    _work_cond.signal();
	    _work_cond.unlock();
	}