Thread fixes for WinCE

This commit is contained in:
Günter Obiltschnig
2014-11-24 14:34:27 +01:00
parent d5d048e689
commit 5f8d7ef994
2 changed files with 5 additions and 54 deletions

View File

@@ -61,29 +61,17 @@ void ThreadImpl::setOSPriorityImpl(int prio, int /* policy */)
}
void ThreadImpl::startImpl(Runnable& target)
void ThreadImpl::startImpl(SharedPtr<Runnable> pTarget)
{
if (isRunningImpl())
throw SystemException("thread already running");
_pRunnableTarget = &target;
_pRunnableTarget = pTarget;
createImpl(runnableEntry, this);
}
void ThreadImpl::startImpl(Callable target, void* pData)
{
if (isRunningImpl())
throw SystemException("thread already running");
_callbackTarget.callback = target;
_callbackTarget.pData = pData;
createImpl(callableEntry, this);
}
void ThreadImpl::createImpl(Entry ent, void* pData)
{
_thread = CreateThread(NULL, _stackSize, ent, pData, 0, &_threadId);
@@ -180,28 +168,4 @@ DWORD WINAPI ThreadImpl::runnableEntry(LPVOID pThread)
}
DWORD WINAPI ThreadImpl::callableEntry(LPVOID pThread)
{
_currentThreadHolder.set(reinterpret_cast<ThreadImpl*>(pThread));
try
{
ThreadImpl* pTI = reinterpret_cast<ThreadImpl*>(pThread);
pTI->_callbackTarget.callback(pTI->_callbackTarget.pData);
}
catch (Exception& exc)
{
ErrorHandler::handle(exc);
}
catch (std::exception& exc)
{
ErrorHandler::handle(exc);
}
catch (...)
{
ErrorHandler::handle();
}
return 0;
}
} // namespace Poco