Esempio n. 1
0
void Thread::start() throw (ThreadCreateException)
{
	if (active)
		return;
	int err = pthread_create(&threadID, NULL, &threadProc, this);
	if (err)
		throw ThreadCreateException(err);
	active = true;
}
Esempio n. 2
0
void ThreadPool::promoteFollower( pthread_t thid )
{
if(_sizeMax > 1)
{
this->lock();
assert(!_promote);
_promote = true;
this->notify();

if(!_destroyed)
{
assert(_inUse >= 0);
++_inUse;

if(_inUse == _sizeWarn)
{
}

assert(_inUse <= _running);
if(_inUse < _sizeMax && _inUse == _running)
{
try
{
ThreadPtr thread = new EventHandlerThread(this);
thread->start(_stackSize);
_threads.push_back(thread);
++_running;
}
catch(const Exception& ex)
{
throw ThreadCreateException(__FILE__,__LINE__);
}
}
}
this->unlock();
}
}