diff --git a/src_main/thread/pithread.cpp b/src_main/thread/pithread.cpp index 6ce4e20a..a93f6065 100755 --- a/src_main/thread/pithread.cpp +++ b/src_main/thread/pithread.cpp @@ -190,8 +190,10 @@ PIThread::~PIThread() { #ifdef FREERTOS //void * ret(0); piCout << "~PIThread" << PRIVATE->thread; - piCout << pthread_join(PRIVATE->thread, 0); - piCout << "FREERTOS can't join pthreads!"; + //piCout << pthread_join(PRIVATE->thread, 0); + piCout << "FreeRTOS can't join pthreads! waiting for stop"; + stop(true); + piCout << "stopped!" #else #ifndef WINDOWS # ifdef ANDROID @@ -292,14 +294,16 @@ bool PIThread::startOnce() { void PIThread::terminate() { +#ifdef FREERTOS + piCout << "FreeRTOS can't terminate pthreads! waiting for stop"; + stop(true); + piCout << "stopped!" +#else if (PRIVATE->thread == 0) return; UNREGISTER_THREAD(this); PIINTROSPECTION_UNREGISTER_THREAD(tid()); terminating = running_ = false; tid_ = -1; -#ifdef FREERTOS - piCout << "FREERTOS can't terminate pthreads!"; -#endif //piCout << "terminate" << PRIVATE->thread; #ifndef WINDOWS # ifdef ANDROID @@ -316,6 +320,7 @@ void PIThread::terminate() { #endif PRIVATE->thread = 0; end(); +#endif }