AP_HAL_Linux: Thread: allow loose running thread

This commit is contained in:
Lucas De Marchi 2018-07-10 15:07:00 -07:00 committed by Andrew Tridgell
parent ba0fb3d9d2
commit e11d268818
2 changed files with 7 additions and 0 deletions

View File

@ -40,6 +40,10 @@ void *Thread::_run_trampoline(void *arg)
thread->_poison_stack();
thread->_run();
if (thread->_auto_free) {
delete thread;
}
return nullptr;
}

View File

@ -45,6 +45,8 @@ public:
bool set_stack_size(size_t stack_size);
void set_auto_free(bool auto_free) { _auto_free = auto_free; }
virtual bool stop() { return false; }
bool join();
@ -64,6 +66,7 @@ protected:
task_t _task;
bool _started = false;
bool _should_exit = false;
bool _auto_free = false;
pthread_t _ctx = 0;
struct stack_debug {