From f09111b6a2c2fe4c9e4986f1d0841dc6f926c6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Wed, 6 Feb 2019 21:28:16 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@701 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src_main/thread/pithread.cpp | 10 ++++++++-- src_main/thread/pitimer.cpp | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src_main/thread/pithread.cpp b/src_main/thread/pithread.cpp index b3c16f7a..a33d68c9 100755 --- a/src_main/thread/pithread.cpp +++ b/src_main/thread/pithread.cpp @@ -187,8 +187,11 @@ PIThread::PIThread(bool startNow, int timer_delay): PIObject() { PIThread::~PIThread() { piMonitor.threads--; if (!running_ || PRIVATE->thread == 0) return; +#ifdef FREERTOS + piCout << "FREERTOS can't terminate pthreads!"; +#endif #ifndef WINDOWS -# if defined(ANDROID) || defined(FREERTOS) +# ifdef ANDROID pthread_kill(PRIVATE->thread, SIGTERM); # else pthread_cancel(PRIVATE->thread); @@ -287,9 +290,12 @@ void PIThread::terminate() { PIINTROSPECTION_UNREGISTER_THREAD(tid()); terminating = running_ = false; tid_ = -1; +#ifdef FREERTOS + piCout << "FREERTOS can't terminate pthreads!"; +#endif //piCout << "terminate" << PRIVATE->thread; #ifndef WINDOWS -# if defined(ANDROID) || defined(FREERTOS) +# ifdef ANDROID pthread_kill(PRIVATE->thread, SIGTERM); # else //pthread_kill(PRIVATE->thread, SIGKILL); diff --git a/src_main/thread/pitimer.cpp b/src_main/thread/pitimer.cpp index 34a019a1..bdfa1d37 100755 --- a/src_main/thread/pitimer.cpp +++ b/src_main/thread/pitimer.cpp @@ -442,7 +442,11 @@ bool _PITimerImp_Pool::stopTimer(bool wait) { PITimer::PITimer(): PIObject() { piMonitor.timers++; +#ifdef FREERTOS + imp_mode = PITimer::Pool; +#else imp_mode = PITimer::Thread; +#endif initFirst(); } @@ -511,6 +515,7 @@ void PITimer::init() { void PITimer::destroy() { //piCout << "destroy" << this << imp; if (imp == 0) return; + imp->stop(true); delete imp; imp = 0; }