mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-17 04:37:35 +08:00
Set stack size to minimum valid size if less requested
The stack size cannot be less than PTHREAD_STACK_MIN. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
committed by
Julian Oes
parent
e57d936d8b
commit
d29a2ecfac
@@ -50,6 +50,7 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@@ -172,10 +173,13 @@ px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
if (stack_size < PTHREAD_STACK_MIN) {
|
||||
stack_size = PTHREAD_STACK_MIN;
|
||||
}
|
||||
rv = pthread_attr_setstacksize(&attr, stack_size);
|
||||
|
||||
if (rv != 0) {
|
||||
PX4_ERR("pthread_attr_setstacksize returned error");
|
||||
PX4_ERR("pthread_attr_setstacksize to %d returned error (%d)", stack_size, rv);
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user