Thread_POSIX.h | Thread_POSIX.h | |||
---|---|---|---|---|
// | // | |||
// Thread_POSIX.h | // Thread_POSIX.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/Thread_POSIX.h#8 $ | // $Id: //poco/1.3/Foundation/include/Poco/Thread_POSIX.h#9 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Thread | // Module: Thread | |||
// | // | |||
// Definition of the ThreadImpl class for POSIX Threads. | // Definition of the ThreadImpl class for POSIX Threads. | |||
// | // | |||
// Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 178 | skipping to change at line 178 | |||
inline int ThreadImpl::getPriorityImpl() const | inline int ThreadImpl::getPriorityImpl() const | |||
{ | { | |||
return _pData->prio; | return _pData->prio; | |||
} | } | |||
inline int ThreadImpl::getOSPriorityImpl() const | inline int ThreadImpl::getOSPriorityImpl() const | |||
{ | { | |||
return _pData->osPrio; | return _pData->osPrio; | |||
} | } | |||
inline void ThreadImpl::sleepImpl(long milliseconds) | ||||
{ | ||||
#if defined(__VMS) || defined(__digital__) | ||||
// This is specific to DECThreads | ||||
struct timespec interval; | ||||
interval.tv_sec = milliseconds / 1000; | ||||
interval.tv_nsec = (milliseconds % 1000)*1000000; | ||||
pthread_delay_np(&interval); | ||||
#else | ||||
struct timeval tv; | ||||
tv.tv_sec = milliseconds / 1000; | ||||
tv.tv_usec = (milliseconds % 1000) * 1000; | ||||
select(0, NULL, NULL, NULL, &tv); | ||||
#endif | ||||
} | ||||
inline bool ThreadImpl::isRunningImpl() const | inline bool ThreadImpl::isRunningImpl() const | |||
{ | { | |||
return _pData->pRunnableTarget != 0 || | return _pData->pRunnableTarget != 0 || | |||
(_pData->pCallbackTarget.get() != 0 && _pData->pCallbackTarg et->callback != 0); | (_pData->pCallbackTarget.get() != 0 && _pData->pCallbackTarg et->callback != 0); | |||
} | } | |||
inline void ThreadImpl::yieldImpl() | inline void ThreadImpl::yieldImpl() | |||
{ | { | |||
sched_yield(); | sched_yield(); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
17 lines changed or deleted | 1 lines changed or added | |||