mirror of
https://github.com/pocoproject/poco.git
synced 2025-12-09 16:36:51 +01:00
added support for starting functors/lambdas to Poco::Thread class
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "Poco/Event.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include <pthread.h>
|
||||
// must be limits.h (not <climits>) for PTHREAD_STACK_MIN on Solaris
|
||||
#include <limits.h>
|
||||
@@ -61,16 +62,6 @@ public:
|
||||
POLICY_DEFAULT_IMPL = SCHED_OTHER
|
||||
};
|
||||
|
||||
struct CallbackData: public RefCountedObject
|
||||
{
|
||||
CallbackData(): callback(0), pData(0)
|
||||
{
|
||||
}
|
||||
|
||||
Callable callback;
|
||||
void* pData;
|
||||
};
|
||||
|
||||
ThreadImpl();
|
||||
~ThreadImpl();
|
||||
|
||||
@@ -83,9 +74,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;
|
||||
@@ -129,8 +118,6 @@ private:
|
||||
struct ThreadData: public RefCountedObject
|
||||
{
|
||||
ThreadData():
|
||||
pRunnableTarget(0),
|
||||
pCallbackTarget(0),
|
||||
thread(0),
|
||||
prio(PRIO_NORMAL_IMPL),
|
||||
policy(SCHED_OTHER),
|
||||
@@ -146,8 +133,7 @@ private:
|
||||
#endif
|
||||
}
|
||||
|
||||
Runnable* pRunnableTarget;
|
||||
AutoPtr<CallbackData> pCallbackTarget;
|
||||
SharedPtr<Runnable> pRunnableTarget;
|
||||
pthread_t thread;
|
||||
int prio;
|
||||
int osPrio;
|
||||
|
||||
Reference in New Issue
Block a user