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