mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 14:23:33 +08:00
Provide macros and extensions to the task spawn command to set the stack sizes right
This commit is contained in:
@@ -185,11 +185,7 @@ px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int
|
||||
stack_size = PTHREAD_STACK_MIN;
|
||||
}
|
||||
|
||||
// The stack size is intended for 32-bit architectures; therefore
|
||||
// we often run out of stack space when pointers are larger than 4 bytes.
|
||||
// Double the stack size on posix when we're on a 64-bit architecture.
|
||||
stack_size *= __SIZEOF_POINTER__ >> 2;
|
||||
rv = pthread_attr_setstacksize(&attr, stack_size);
|
||||
rv = pthread_attr_setstacksize(&attr, PX4_STACK_ADJUSTED(stack_size));
|
||||
|
||||
if (rv != 0) {
|
||||
PX4_ERR("pthread_attr_setstacksize to %d returned error (%d)", stack_size, rv);
|
||||
|
||||
Reference in New Issue
Block a user