#15 убрать PIP_CXX11_SUPPORT

This commit is contained in:
2020-07-17 11:51:30 +03:00
parent 33a6382f4d
commit b772928dc1
11 changed files with 8 additions and 92 deletions

View File

@@ -60,11 +60,7 @@ public:
static __PIThreadCollection_Initializer__ __PIThreadCollection_initializer__;
#ifdef PIP_CXX11_SUPPORT
typedef std::function<void(void *)> ThreadFunc;
#else
typedef void (*ThreadFunc)(void * );
#endif
class PIP_EXPORT PIThread: public PIObject
{
@@ -76,10 +72,8 @@ public:
//! Contructs thread with custom data "data", external function "func" and main loop delay "loop_delay".
PIThread(void * data, ThreadFunc func, bool startNow = false, int loop_delay = -1);
#ifdef PIP_CXX11_SUPPORT
//! Contructs thread with external function "func" and main loop delay "loop_delay".
PIThread(std::function<void()> func, bool startNow = false, int loop_delay = -1);
#endif
//! Contructs thread with main loop delay "loop_delay".
PIThread(bool startNow = false, int loop_delay = -1);
@@ -99,10 +93,8 @@ public:
EVENT_HANDLER1(bool, start, int, timer_delay);
bool start(ThreadFunc func) {return start(func, -1);}
bool start(ThreadFunc func, int timer_delay) {ret_func = func; return start(timer_delay);}
#ifdef PIP_CXX11_SUPPORT
bool start(std::function<void()> func) {return start(func, -1);}
bool start(std::function<void()> func, int timer_delay) {ret_func = [func](void*){func();}; return start(timer_delay);}
#endif
EVENT_HANDLER0(bool, startOnce);
EVENT_HANDLER1(bool, startOnce, ThreadFunc, func) {ret_func = func; return startOnce();}
EVENT_HANDLER0(void, stop) {stop(false);}
@@ -115,10 +107,8 @@ public:
//! \brief Set external function that will be executed after every \a run()
void setSlot(ThreadFunc func) {ret_func = func;}
#ifdef PIP_CXX11_SUPPORT
//! \brief Set external function that will be executed after every \a run()
void setSlot(std::function<void()> func) {ret_func = [func](void*){func();};}
#endif
//! \brief Set priority of thread
void setPriority(PIThread::Priority prior);
@@ -161,11 +151,9 @@ public:
//! and automatically delete it on function finish
static void runOnce(PIObject * object, const char * handler, const PIString & name = PIString());
#ifdef PIP_CXX11_SUPPORT
//! \brief Start function \"func\" in separate thread with name \"name\"
//! and automatically delete it on function finish
static void runOnce(std::function<void()> func, const PIString & name = PIString());
#endif
//! \handlers
//! \{