android (maybe some other *nix) fix
This commit is contained in:
@@ -737,7 +737,7 @@ bool PIThread::_startThread(void * func) {
|
|||||||
#ifdef FREERTOS
|
#ifdef FREERTOS
|
||||||
|
|
||||||
auto name_ba = createThreadName();
|
auto name_ba = createThreadName();
|
||||||
if (xTaskCreate((__THREAD_FUNC_RET__(*)(void *))func,
|
if (xTaskCreate((__THREAD_FUNC_RET__ (*)(void *))func,
|
||||||
(const char *)name_ba.data(), // A name just for humans
|
(const char *)name_ba.data(), // A name just for humans
|
||||||
128, // This stack size can be checked & adjusted by reading the Stack Highwater
|
128, // This stack size can be checked & adjusted by reading the Stack Highwater
|
||||||
this,
|
this,
|
||||||
@@ -751,7 +751,7 @@ bool PIThread::_startThread(void * func) {
|
|||||||
|
|
||||||
if (PRIVATE->thread) CloseHandle(PRIVATE->thread);
|
if (PRIVATE->thread) CloseHandle(PRIVATE->thread);
|
||||||
# ifdef CC_GCC
|
# ifdef CC_GCC
|
||||||
PRIVATE->thread = (void *)_beginthreadex(0, 0, (__THREAD_FUNC_RET__(*)(void *))func, this, CREATE_SUSPENDED, 0);
|
PRIVATE->thread = (void *)_beginthreadex(0, 0, (__THREAD_FUNC_RET__ (*)(void *))func, this, CREATE_SUSPENDED, 0);
|
||||||
# else
|
# else
|
||||||
PRIVATE->thread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)func, this, CREATE_SUSPENDED, 0);
|
PRIVATE->thread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)func, this, CREATE_SUSPENDED, 0);
|
||||||
# endif
|
# endif
|
||||||
@@ -765,7 +765,7 @@ bool PIThread::_startThread(void * func) {
|
|||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
int ret = pthread_create(&PRIVATE->thread, &attr, (__THREAD_FUNC_RET__(*)(void *))func, this);
|
int ret = pthread_create(&PRIVATE->thread, &attr, (__THREAD_FUNC_RET__ (*)(void *))func, this);
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
// PICout(PICoutManipulators::DefaultControls) << "pthread_create" << PRIVATE->thread;
|
// PICout(PICoutManipulators::DefaultControls) << "pthread_create" << PRIVATE->thread;
|
||||||
// piCout << "started" << PRIVATE->thread;
|
// piCout << "started" << PRIVATE->thread;
|
||||||
@@ -895,8 +895,8 @@ void PIThread::_runThread() {
|
|||||||
PIINTROSPECTION_THREAD_RUN(this);
|
PIINTROSPECTION_THREAD_RUN(this);
|
||||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "...";
|
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "...";
|
||||||
if (lockRun) thread_mutex.lock();
|
if (lockRun) thread_mutex.lock();
|
||||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "ok";
|
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "ok";
|
||||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "run" << "...";
|
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "run" << "...";
|
||||||
#ifdef PIP_INTROSPECTION
|
#ifdef PIP_INTROSPECTION
|
||||||
PITimeMeasurer _tm;
|
PITimeMeasurer _tm;
|
||||||
#endif
|
#endif
|
||||||
@@ -920,9 +920,9 @@ void PIThread::_endThread() {
|
|||||||
terminating = running_ = false;
|
terminating = running_ = false;
|
||||||
tid_ = -1;
|
tid_ = -1;
|
||||||
});
|
});
|
||||||
// while (PRIVATE->starting)
|
// while (PRIVATE->starting)
|
||||||
// piMinSleep();
|
// piMinSleep();
|
||||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "...";
|
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "...";
|
||||||
stopped();
|
stopped();
|
||||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "ok";
|
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "ok";
|
||||||
if (lockRun) thread_mutex.lock();
|
if (lockRun) thread_mutex.lock();
|
||||||
@@ -945,8 +945,8 @@ void PIThread::_endThread() {
|
|||||||
#elif defined(FREERTOS)
|
#elif defined(FREERTOS)
|
||||||
PRIVATE->thread = 0;
|
PRIVATE->thread = 0;
|
||||||
#else
|
#else
|
||||||
// pthread_detach(PRIVATE->thread);
|
|
||||||
PRIVATE->thread = 0;
|
PRIVATE->thread = 0;
|
||||||
|
ec.callAndCancel();
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user