Provide macros and extensions to the task spawn command to set the stack sizes right

This commit is contained in:
Lorenz Meier
2016-09-11 20:07:30 +02:00
parent efd64e2cd2
commit 5b69e58925
3 changed files with 12 additions and 6 deletions
@@ -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);