mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-17 03:03:23 +02:00
added support for starting functors/lambdas to Poco::Thread class
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Runnable.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/UnWindows.h"
|
||||
|
||||
|
||||
@@ -40,16 +41,6 @@ public:
|
||||
typedef unsigned (__stdcall *Entry)(void*);
|
||||
#endif
|
||||
|
||||
struct CallbackData
|
||||
{
|
||||
CallbackData(): callback(0), pData(0)
|
||||
{
|
||||
}
|
||||
|
||||
Callable callback;
|
||||
void* pData;
|
||||
};
|
||||
|
||||
enum Priority
|
||||
{
|
||||
PRIO_LOWEST_IMPL = THREAD_PRIORITY_LOWEST,
|
||||
@@ -76,9 +67,7 @@ public:
|
||||
static int getMaxOSPriorityImpl(int policy);
|
||||
void setStackSizeImpl(int size);
|
||||
int getStackSizeImpl() const;
|
||||
void startImpl(Runnable& target);
|
||||
void startImpl(Callable target, void* pData = 0);
|
||||
|
||||
void startImpl(SharedPtr<Runnable> pTarget);
|
||||
void joinImpl();
|
||||
bool joinImpl(long milliseconds);
|
||||
bool isRunningImpl() const;
|
||||
@@ -94,12 +83,6 @@ protected:
|
||||
static unsigned __stdcall runnableEntry(void* pThread);
|
||||
#endif
|
||||
|
||||
#if defined(_DLL)
|
||||
static DWORD WINAPI callableEntry(LPVOID pThread);
|
||||
#else
|
||||
static unsigned __stdcall callableEntry(void* pThread);
|
||||
#endif
|
||||
|
||||
void createImpl(Entry ent, void* pData);
|
||||
void threadCleanup();
|
||||
|
||||
@@ -129,12 +112,11 @@ private:
|
||||
DWORD _slot;
|
||||
};
|
||||
|
||||
Runnable* _pRunnableTarget;
|
||||
CallbackData _callbackTarget;
|
||||
HANDLE _thread;
|
||||
DWORD _threadId;
|
||||
int _prio;
|
||||
int _stackSize;
|
||||
SharedPtr<Runnable> _pRunnableTarget;
|
||||
HANDLE _thread;
|
||||
DWORD _threadId;
|
||||
int _prio;
|
||||
int _stackSize;
|
||||
|
||||
static CurrentThreadHolder _currentThreadHolder;
|
||||
};
|
||||
|
Reference in New Issue
Block a user