mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-13 06:44:13 +02:00
some cosmetic changes
This commit is contained in:
@@ -54,7 +54,7 @@ class RunnableAdapter: public Runnable
|
|||||||
/// Usage:
|
/// Usage:
|
||||||
/// RunnableAdapter<MyClass> ra(myObject, &MyObject::doSomething));
|
/// RunnableAdapter<MyClass> ra(myObject, &MyObject::doSomething));
|
||||||
/// Thread thr;
|
/// Thread thr;
|
||||||
/// thr.Start(ra);
|
/// thr.start(ra);
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef void (C::*Callback)();
|
typedef void (C::*Callback)();
|
||||||
|
@@ -68,7 +68,7 @@ class Foundation_API Thread: private ThreadImpl
|
|||||||
/// The name of a thread can be changed at any time.
|
/// The name of a thread can be changed at any time.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using ThreadImpl::Callback;
|
using ThreadImpl::Callable;
|
||||||
|
|
||||||
enum Priority
|
enum Priority
|
||||||
/// Thread priorities.
|
/// Thread priorities.
|
||||||
@@ -140,7 +140,7 @@ public:
|
|||||||
void start(Runnable& target);
|
void start(Runnable& target);
|
||||||
/// Starts the thread with the given target.
|
/// Starts the thread with the given target.
|
||||||
|
|
||||||
void start(Callback target, void* pData = 0);
|
void start(Callable target, void* pData = 0);
|
||||||
/// Starts the thread with the given target and parameter.
|
/// Starts the thread with the given target and parameter.
|
||||||
|
|
||||||
void join();
|
void join();
|
||||||
|
@@ -59,7 +59,7 @@ namespace Poco {
|
|||||||
class Foundation_API ThreadImpl
|
class Foundation_API ThreadImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef void (*Callback)(void*);
|
typedef void (*Callable)(void*);
|
||||||
|
|
||||||
enum Priority
|
enum Priority
|
||||||
{
|
{
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Callback callback;
|
Callable callback;
|
||||||
void* pData;
|
void* pData;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ public:
|
|||||||
void setStackSizeImpl(int size);
|
void setStackSizeImpl(int size);
|
||||||
int getStackSizeImpl() const;
|
int getStackSizeImpl() const;
|
||||||
void startImpl(Runnable& target);
|
void startImpl(Runnable& target);
|
||||||
void startImpl(Callback target, void* pData = 0);
|
void startImpl(Callable target, void* pData = 0);
|
||||||
|
|
||||||
void joinImpl();
|
void joinImpl();
|
||||||
bool joinImpl(long milliseconds);
|
bool joinImpl(long milliseconds);
|
||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void* runnableEntry(void* pThread);
|
static void* runnableEntry(void* pThread);
|
||||||
static void* functionEntry(void* pThread);
|
static void* callableEntry(void* pThread);
|
||||||
static int mapPrio(int prio);
|
static int mapPrio(int prio);
|
||||||
static int reverseMapPrio(int osPrio);
|
static int reverseMapPrio(int osPrio);
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ namespace Poco {
|
|||||||
class Foundation_API ThreadImpl
|
class Foundation_API ThreadImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef void (*Callback)(void*);
|
typedef void (*Callable)(void*);
|
||||||
|
|
||||||
#if defined(_DLL)
|
#if defined(_DLL)
|
||||||
typedef DWORD (WINAPI *Entry)(LPVOID);
|
typedef DWORD (WINAPI *Entry)(LPVOID);
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Callback callback;
|
Callable callback;
|
||||||
void* pData;
|
void* pData;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
void setStackSizeImpl(int size);
|
void setStackSizeImpl(int size);
|
||||||
int getStackSizeImpl() const;
|
int getStackSizeImpl() const;
|
||||||
void startImpl(Runnable& target);
|
void startImpl(Runnable& target);
|
||||||
void startImpl(Callback target, void* pData = 0);
|
void startImpl(Callable target, void* pData = 0);
|
||||||
|
|
||||||
void joinImpl();
|
void joinImpl();
|
||||||
bool joinImpl(long milliseconds);
|
bool joinImpl(long milliseconds);
|
||||||
@@ -107,9 +107,9 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_DLL)
|
#if defined(_DLL)
|
||||||
static DWORD WINAPI functionEntry(LPVOID pThread);
|
static DWORD WINAPI callableEntry(LPVOID pThread);
|
||||||
#else
|
#else
|
||||||
static unsigned __stdcall functionEntry(void* pThread);
|
static unsigned __stdcall callableEntry(void* pThread);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void createImpl(Entry ent, void* pData);
|
void createImpl(Entry ent, void* pData);
|
||||||
|
@@ -91,7 +91,7 @@ void Thread::start(Runnable& target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Thread::start(Callback target, void* pData)
|
void Thread::start(Callable target, void* pData)
|
||||||
{
|
{
|
||||||
startImpl(target, pData);
|
startImpl(target, pData);
|
||||||
}
|
}
|
||||||
|
@@ -184,7 +184,7 @@ void ThreadImpl::startImpl(Runnable& target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ThreadImpl::startImpl(Callback target, void* pData)
|
void ThreadImpl::startImpl(Callable target, void* pData)
|
||||||
{
|
{
|
||||||
if (_pData->pCallbackTarget && _pData->pCallbackTarget->callback)
|
if (_pData->pCallbackTarget && _pData->pCallbackTarget->callback)
|
||||||
throw SystemException("thread already running");
|
throw SystemException("thread already running");
|
||||||
@@ -204,7 +204,7 @@ void ThreadImpl::startImpl(Callback target, void* pData)
|
|||||||
_pData->pCallbackTarget->callback = target;
|
_pData->pCallbackTarget->callback = target;
|
||||||
_pData->pCallbackTarget->pData = pData;
|
_pData->pCallbackTarget->pData = pData;
|
||||||
|
|
||||||
if (pthread_create(&_pData->thread, &attributes, functionEntry, this))
|
if (pthread_create(&_pData->thread, &attributes, callableEntry, this))
|
||||||
{
|
{
|
||||||
_pData->pCallbackTarget->callback = 0;
|
_pData->pCallbackTarget->callback = 0;
|
||||||
_pData->pCallbackTarget->pData = 0;
|
_pData->pCallbackTarget->pData = 0;
|
||||||
@@ -290,7 +290,7 @@ void* ThreadImpl::runnableEntry(void* pThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* ThreadImpl::functionEntry(void* pThread)
|
void* ThreadImpl::callableEntry(void* pThread)
|
||||||
{
|
{
|
||||||
pthread_setspecific(_currentKey, pThread);
|
pthread_setspecific(_currentKey, pThread);
|
||||||
|
|
||||||
|
@@ -98,7 +98,7 @@ void ThreadImpl::startImpl(Runnable& target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ThreadImpl::startImpl(Callback target, void* pData)
|
void ThreadImpl::startImpl(Callable target, void* pData)
|
||||||
{
|
{
|
||||||
if (isRunningImpl())
|
if (isRunningImpl())
|
||||||
throw SystemException("thread already running");
|
throw SystemException("thread already running");
|
||||||
@@ -106,7 +106,7 @@ void ThreadImpl::startImpl(Callback target, void* pData)
|
|||||||
_callbackTarget.callback = target;
|
_callbackTarget.callback = target;
|
||||||
_callbackTarget.pData = pData;
|
_callbackTarget.pData = pData;
|
||||||
|
|
||||||
createImpl(functionEntry, this);
|
createImpl(callableEntry, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -213,9 +213,9 @@ unsigned __stdcall ThreadImpl::runnableEntry(void* pThread)
|
|||||||
|
|
||||||
|
|
||||||
#if defined(_DLL)
|
#if defined(_DLL)
|
||||||
DWORD WINAPI ThreadImpl::functionEntry(LPVOID pThread)
|
DWORD WINAPI ThreadImpl::callableEntry(LPVOID pThread)
|
||||||
#else
|
#else
|
||||||
unsigned __stdcall ThreadImpl::functionEntry(void* pThread)
|
unsigned __stdcall ThreadImpl::callableEntry(void* pThread)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
TlsSetValue(_currentKey, pThread);
|
TlsSetValue(_currentKey, pThread);
|
||||||
|
Reference in New Issue
Block a user