|
|
|
@ -348,16 +348,9 @@ void Scheduler::teardown()
@@ -348,16 +348,9 @@ void Scheduler::teardown()
|
|
|
|
|
_uart_thread.join(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
create a new thread |
|
|
|
|
*/ |
|
|
|
|
bool Scheduler::thread_create(AP_HAL::MemberProc proc, const char *name, uint32_t stack_size, priority_base base, int8_t priority) |
|
|
|
|
// calculates an integer to be used as the priority for a newly-created thread
|
|
|
|
|
uint8_t Scheduler::calculate_thread_priority(priority_base base, int8_t priority) const |
|
|
|
|
{ |
|
|
|
|
Thread *thread = new Thread{(Thread::task_t)proc}; |
|
|
|
|
if (!thread) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint8_t thread_priority = APM_LINUX_IO_PRIORITY; |
|
|
|
|
static const struct { |
|
|
|
|
priority_base base; |
|
|
|
@ -382,6 +375,21 @@ bool Scheduler::thread_create(AP_HAL::MemberProc proc, const char *name, uint32_
@@ -382,6 +375,21 @@ bool Scheduler::thread_create(AP_HAL::MemberProc proc, const char *name, uint32_
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return thread_priority; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
create a new thread |
|
|
|
|
*/ |
|
|
|
|
bool Scheduler::thread_create(AP_HAL::MemberProc proc, const char *name, uint32_t stack_size, priority_base base, int8_t priority) |
|
|
|
|
{ |
|
|
|
|
Thread *thread = new Thread{(Thread::task_t)proc}; |
|
|
|
|
if (!thread) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const uint8_t thread_priority = calculate_thread_priority(base, priority); |
|
|
|
|
|
|
|
|
|
// Add 256k to HAL-independent requested stack size
|
|
|
|
|
thread->set_stack_size(256 * 1024 + stack_size); |
|
|
|
|
|
|
|
|
|