Browse Source

AP_HAL_Linux: Thread: allow loose running thread

mission-4.1.18
Lucas De Marchi 7 years ago committed by Andrew Tridgell
parent
commit
e11d268818
  1. 4
      libraries/AP_HAL_Linux/Thread.cpp
  2. 3
      libraries/AP_HAL_Linux/Thread.h

4
libraries/AP_HAL_Linux/Thread.cpp

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

3
libraries/AP_HAL_Linux/Thread.h

@ -45,6 +45,8 @@ public: @@ -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: @@ -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 {

Loading…
Cancel
Save