mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-18 00:15:27 +01:00
Thread fixes for POSIX
This commit is contained in:
parent
7043a3d4ff
commit
4b53f137de
@ -85,7 +85,6 @@ public:
|
||||
|
||||
protected:
|
||||
static void* runnableEntry(void* pThread);
|
||||
static void* callableEntry(void* pThread);
|
||||
static int mapPrio(int prio, int policy = SCHED_OTHER);
|
||||
static int reverseMapPrio(int osPrio, int policy = SCHED_OTHER);
|
||||
|
||||
@ -172,8 +171,7 @@ inline int ThreadImpl::getOSPriorityImpl() const
|
||||
|
||||
inline bool ThreadImpl::isRunningImpl() const
|
||||
{
|
||||
return _pData->pRunnableTarget != 0 ||
|
||||
(_pData->pCallbackTarget.get() != 0 && _pData->pCallbackTarget->callback != 0);
|
||||
return !_pData->pRunnableTarget.isNull();
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,7 +120,7 @@ void ThreadImpl::setOSPriorityImpl(int prio, int policy)
|
||||
{
|
||||
if (prio != _pData->osPrio || policy != _pData->policy)
|
||||
{
|
||||
if (_pData->pRunnableTarget || _pData->pCallbackTarget)
|
||||
if (_pData->pRunnableTarget)
|
||||
{
|
||||
struct sched_param par;
|
||||
par.sched_priority = prio;
|
||||
@ -362,48 +362,6 @@ void* ThreadImpl::runnableEntry(void* pThread)
|
||||
}
|
||||
|
||||
|
||||
void* ThreadImpl::callableEntry(void* pThread)
|
||||
{
|
||||
_currentThreadHolder.set(reinterpret_cast<ThreadImpl*>(pThread));
|
||||
|
||||
#if defined(POCO_OS_FAMILY_UNIX)
|
||||
sigset_t sset;
|
||||
sigemptyset(&sset);
|
||||
sigaddset(&sset, SIGQUIT);
|
||||
sigaddset(&sset, SIGTERM);
|
||||
sigaddset(&sset, SIGPIPE);
|
||||
pthread_sigmask(SIG_BLOCK, &sset, 0);
|
||||
#endif
|
||||
|
||||
ThreadImpl* pThreadImpl = reinterpret_cast<ThreadImpl*>(pThread);
|
||||
#if defined(POCO_POSIX_DEBUGGER_THREAD_NAMES)
|
||||
setThreadName(pThreadImpl->_pData->thread, reinterpret_cast<Thread*>(pThread)->getName().c_str());
|
||||
#endif
|
||||
AutoPtr<ThreadData> pData = pThreadImpl->_pData;
|
||||
try
|
||||
{
|
||||
pData->pCallbackTarget->callback(pData->pCallbackTarget->pData);
|
||||
}
|
||||
catch (Exception& exc)
|
||||
{
|
||||
ErrorHandler::handle(exc);
|
||||
}
|
||||
catch (std::exception& exc)
|
||||
{
|
||||
ErrorHandler::handle(exc);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
ErrorHandler::handle();
|
||||
}
|
||||
|
||||
pData->pCallbackTarget->callback = 0;
|
||||
pData->pCallbackTarget->pData = 0;
|
||||
pData->done.set();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int ThreadImpl::mapPrio(int prio, int policy)
|
||||
{
|
||||
int pmin = getMinOSPriorityImpl(policy);
|
||||
|
Loading…
x
Reference in New Issue
Block a user