|
ChibiOS/RT
2.5.1 |
|
Dynamic threads related APIs and services.
Functions | |
| Thread * | chThdAddRef (Thread *tp) |
| Adds a reference to a thread object. | |
| void | chThdRelease (Thread *tp) |
| Releases a reference to a thread object. | |
| Thread * | chThdCreateFromHeap (MemoryHeap *heapp, size_t size, tprio_t prio, tfunc_t pf, void *arg) |
| Creates a new thread allocating the memory from the heap. | |
| Thread * | chThdCreateFromMemoryPool (MemoryPool *mp, tprio_t prio, tfunc_t pf, void *arg) |
| Creates a new thread allocating the memory from the specified memory pool. | |
Adds a reference to a thread object.
CH_USE_DYNAMIC must be enabled in order to use this function.| [in] | tp | pointer to the thread |
Definition at line 45 of file chdynamic.c.
References chDbgAssert, chSysLock, chSysUnlock, and Thread::p_refs.
| void chThdRelease | ( | Thread * | tp | ) |
Releases a reference to a thread object.
If the references counter reaches zero and the thread is in the THD_STATE_FINAL state then the thread's memory is returned to the proper allocator.
CH_USE_DYNAMIC must be enabled in order to use this function. | [in] | tp | pointer to the thread |
Definition at line 67 of file chdynamic.c.
References chDbgAssert, chHeapFree(), chPoolFree(), chSysLock, chSysUnlock, Thread::p_flags, Thread::p_mpool, Thread::p_refs, Thread::p_state, REG_REMOVE, THD_MEM_MODE_HEAP, THD_MEM_MODE_MASK, THD_MEM_MODE_MEMPOOL, and THD_STATE_FINAL.
Referenced by chRegNextThread(), and chThdWait().

| Thread * chThdCreateFromHeap | ( | MemoryHeap * | heapp, |
| size_t | size, | ||
| tprio_t | prio, | ||
| tfunc_t | pf, | ||
| void * | arg | ||
| ) |
Creates a new thread allocating the memory from the heap.
CH_USE_DYNAMIC and CH_USE_HEAP must be enabled in order to use this function. chThdExit() or by simply returning from its main function. chThdWait() is performed.| [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] | 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 structure allocated for the thread into the working space area. | NULL | if the memory cannot be allocated. |
Definition at line 123 of file chdynamic.c.
References _thread_memfill(), CH_STACK_FILL_VALUE, CH_THREAD_FILL_VALUE, chHeapAlloc(), chSchWakeupS(), chSysLock, chSysUnlock, chThdCreateI(), Thread::p_flags, RDY_OK, and THD_MEM_MODE_HEAP.

| Thread * chThdCreateFromMemoryPool | ( | MemoryPool * | mp, |
| tprio_t | prio, | ||
| tfunc_t | pf, | ||
| void * | arg | ||
| ) |
Creates a new thread allocating the memory from the specified memory pool.
CH_USE_DYNAMIC and CH_USE_MEMPOOLS must be enabled in order to use this function. chThdExit() or by simply returning from its main function. chThdWait() is performed.| [in] | mp | pointer to the memory pool object |
| [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 structure allocated for the thread into the working space area. | NULL | if the memory pool is empty. |
Definition at line 172 of file chdynamic.c.
References _thread_memfill(), CH_STACK_FILL_VALUE, CH_THREAD_FILL_VALUE, chDbgCheck, chPoolAlloc(), chSchWakeupS(), chSysLock, chSysUnlock, chThdCreateI(), MemoryPool::mp_object_size, Thread::p_flags, Thread::p_mpool, RDY_OK, and THD_MEM_MODE_MEMPOOL.
