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

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

	    _work_cond.signal();
	    _work_cond.unlock();
	}
Exemple #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();
	}
        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 quit ()
        {
            TScopedLock  lock( _work_cond );

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

            _work_cond.signal();
        }
        void run_job  ( TPool::TJob * j, void * p, const bool del = false )
        {
            TScopedLock  lock( _work_cond );

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

            _work_cond.signal();
        }