mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 00:33:36 +08:00
px4_work_queue: stack size rounded to page size on posix
This commit is contained in:
committed by
Daniel Agar
parent
a08abccdd5
commit
7984c0c910
@@ -203,10 +203,16 @@ WorkQueueManagerRun(int, char **)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// stack size
|
// stack size
|
||||||
#ifndef __PX4_QURT
|
#if defined(__PX4_QURT)
|
||||||
const size_t stacksize = math::max(PTHREAD_STACK_MIN, PX4_STACK_ADJUSTED(wq->stacksize));
|
|
||||||
#else
|
|
||||||
const size_t stacksize = math::max(8 * 1024, PX4_STACK_ADJUSTED(wq->stacksize));
|
const size_t stacksize = math::max(8 * 1024, PX4_STACK_ADJUSTED(wq->stacksize));
|
||||||
|
#elif defined(__PX4_NUTTX)
|
||||||
|
const size_t stacksize = math::max((uint16_t)PTHREAD_STACK_MIN, wq->stacksize);
|
||||||
|
#elif defined(__PX4_POSIX)
|
||||||
|
// On posix system , the desired stacksize round to the nearest multiplier of the system pagesize
|
||||||
|
// It is a requirement of the pthread_attr_setstacksize* function
|
||||||
|
const unsigned int page_size = sysconf(_SC_PAGESIZE);
|
||||||
|
const size_t stacksize_adj = math::max(PTHREAD_STACK_MIN, PX4_STACK_ADJUSTED(wq->stacksize));
|
||||||
|
const size_t stacksize = (stacksize_adj + page_size - (stacksize_adj % page_size));
|
||||||
#endif
|
#endif
|
||||||
int ret_setstacksize = pthread_attr_setstacksize(&attr, stacksize);
|
int ret_setstacksize = pthread_attr_setstacksize(&attr, stacksize);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user