ChibiOS/RT
5.1.0
|
Dynamic threads related APIs and services.
Functions | |
thread_t * | chThdCreateFromHeap (memory_heap_t *heapp, size_t size, const char *name, tprio_t prio, tfunc_t pf, void *arg) |
Creates a new thread allocating the memory from the heap. More... | |
thread_t * | chThdCreateFromMemoryPool (memory_pool_t *mp, const char *name, tprio_t prio, tfunc_t pf, void *arg) |
Creates a new thread allocating the memory from the specified memory pool. More... | |
thread_t * chThdCreateFromHeap | ( | memory_heap_t * | heapp, |
size_t | size, | ||
const char * | name, | ||
tprio_t | prio, | ||
tfunc_t | pf, | ||
void * | arg | ||
) |
Creates a new thread allocating the memory from the heap.
CH_CFG_USE_DYNAMIC
and CH_CFG_USE_HEAP
must be enabled in order to use this function. chThdExit()
or by simply returning from its main function. chThdWait()
and then release the allocated memory.[in] | heapp | heap from which allocate the memory or NULL for the default heap |
[in] | size | size of the working area to be allocated |
[in] | name | thread name |
[in] | prio | the priority level for the new thread |
[in] | pf | the thread function |
[in] | arg | an argument passed to the thread function. It can be NULL . |
thread_t
structure allocated for the thread into the working space area. NULL | if the memory cannot be allocated. |
Definition at line 82 of file chdynamic.c.
References _thread_memfill(), CH_DBG_STACK_FILL_VALUE, CH_FLAG_MODE_HEAP, chHeapAllocAligned(), chSchWakeupS(), chSysLock(), chSysUnlock(), chThdCreateSuspendedI(), ch_thread::flags, and MSG_OK.
thread_t * chThdCreateFromMemoryPool | ( | memory_pool_t * | mp, |
const char * | name, | ||
tprio_t | prio, | ||
tfunc_t | pf, | ||
void * | arg | ||
) |
Creates a new thread allocating the memory from the specified memory pool.
CH_CFG_USE_DYNAMIC
and CH_CFG_USE_MEMPOOLS
must be enabled in order to use this function. PORT_WORKING_AREA_ALIGN
. chThdExit()
or by simply returning from its main function. chThdWait()
and then release the allocated memory.[in] | mp | pointer to the memory pool object |
[in] | name | thread name |
[in] | prio | the priority level for the new thread |
[in] | pf | the thread function |
[in] | arg | an argument passed to the thread function. It can be NULL . |
thread_t
structure allocated for the thread into the working space area. NULL | if the memory pool is empty. |
Definition at line 145 of file chdynamic.c.
References _thread_memfill(), CH_DBG_STACK_FILL_VALUE, CH_FLAG_MODE_MPOOL, chDbgCheck, chPoolAlloc(), chSchWakeupS(), chSysLock(), chSysUnlock(), chThdCreateSuspendedI(), ch_thread::flags, ch_thread::mpool, MSG_OK, and memory_pool_t::object_size.