git-svn-id: svn://db.shs.com.ru/pip@701 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2019-02-06 21:28:16 +00:00
parent 1190c0449c
commit f09111b6a2
2 changed files with 13 additions and 2 deletions

View File

@@ -187,8 +187,11 @@ PIThread::PIThread(bool startNow, int timer_delay): PIObject() {
PIThread::~PIThread() { PIThread::~PIThread() {
piMonitor.threads--; piMonitor.threads--;
if (!running_ || PRIVATE->thread == 0) return; if (!running_ || PRIVATE->thread == 0) return;
#ifdef FREERTOS
piCout << "FREERTOS can't terminate pthreads!";
#endif
#ifndef WINDOWS #ifndef WINDOWS
# if defined(ANDROID) || defined(FREERTOS) # ifdef ANDROID
pthread_kill(PRIVATE->thread, SIGTERM); pthread_kill(PRIVATE->thread, SIGTERM);
# else # else
pthread_cancel(PRIVATE->thread); pthread_cancel(PRIVATE->thread);
@@ -287,9 +290,12 @@ void PIThread::terminate() {
PIINTROSPECTION_UNREGISTER_THREAD(tid()); PIINTROSPECTION_UNREGISTER_THREAD(tid());
terminating = running_ = false; terminating = running_ = false;
tid_ = -1; tid_ = -1;
#ifdef FREERTOS
piCout << "FREERTOS can't terminate pthreads!";
#endif
//piCout << "terminate" << PRIVATE->thread; //piCout << "terminate" << PRIVATE->thread;
#ifndef WINDOWS #ifndef WINDOWS
# if defined(ANDROID) || defined(FREERTOS) # ifdef ANDROID
pthread_kill(PRIVATE->thread, SIGTERM); pthread_kill(PRIVATE->thread, SIGTERM);
# else # else
//pthread_kill(PRIVATE->thread, SIGKILL); //pthread_kill(PRIVATE->thread, SIGKILL);

View File

@@ -442,7 +442,11 @@ bool _PITimerImp_Pool::stopTimer(bool wait) {
PITimer::PITimer(): PIObject() { PITimer::PITimer(): PIObject() {
piMonitor.timers++; piMonitor.timers++;
#ifdef FREERTOS
imp_mode = PITimer::Pool;
#else
imp_mode = PITimer::Thread; imp_mode = PITimer::Thread;
#endif
initFirst(); initFirst();
} }
@@ -511,6 +515,7 @@ void PITimer::init() {
void PITimer::destroy() { void PITimer::destroy() {
//piCout << "destroy" << this << imp; //piCout << "destroy" << this << imp;
if (imp == 0) return; if (imp == 0) return;
imp->stop(true);
delete imp; delete imp;
imp = 0; imp = 0;
} }