From 8f89ec3c0bb6f4bc5a77afd37ebb3919181f7a4d Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 21 Feb 2016 10:45:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8919 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/oslib/src/chdynamic.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'os/common/oslib/src') diff --git a/os/common/oslib/src/chdynamic.c b/os/common/oslib/src/chdynamic.c index 80555a928..3865c318a 100644 --- a/os/common/oslib/src/chdynamic.c +++ b/os/common/oslib/src/chdynamic.c @@ -69,6 +69,7 @@ * @param[in] heapp heap from which allocate the memory or @p NULL for the * default heap * @param[in] size size of the working area to be allocated + * @param[in] name thread name * @param[in] prio the priority level for the new thread * @param[in] pf the thread function * @param[in] arg an argument passed to the thread function. It can be @@ -80,7 +81,8 @@ * @api */ thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size, - tprio_t prio, tfunc_t pf, void *arg) { + const char *name, tprio_t prio, + tfunc_t pf, void *arg) { void *wsp; wsp = chHeapAllocAligned(heapp, size, PORT_WORKING_AREA_ALIGN); @@ -88,13 +90,16 @@ thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size, return NULL; } -#if CH_DBG_FILL_THREADS == TRUE - _thread_memfill((uint8_t *)wsp, - (uint8_t *)wsp + size, - CH_DBG_STACK_FILL_VALUE); -#endif + thread_descriptor_t td = { + name, + wsp, + (stkalign_t *)((uint8_t *)wsp + size), + prio, + pf, + arg + }; - return chThdCreateStatic(wsp, size, prio, pf, arg); + return chThdCreate(&td); } /** @@ -131,6 +136,7 @@ void chThdFreeToHeap(thread_t *tp) { * and then release the allocated memory. * * @param[in] mp pointer to the memory pool object + * @param[in] name thread name * @param[in] prio the priority level for the new thread * @param[in] pf the thread function * @param[in] arg an argument passed to the thread function. It can be @@ -141,8 +147,8 @@ void chThdFreeToHeap(thread_t *tp) { * * @api */ -thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio, - tfunc_t pf, void *arg) { +thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, const char *name, + tprio_t prio, tfunc_t pf, void *arg) { void *wsp; chDbgCheck(mp != NULL); @@ -152,13 +158,16 @@ thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio, return NULL; } -#if CH_DBG_FILL_THREADS == TRUE - _thread_memfill((uint8_t *)wsp, - (uint8_t *)wsp + mp->object_size, - CH_DBG_STACK_FILL_VALUE); -#endif + thread_descriptor_t td = { + name, + wsp, + (stkalign_t *)((uint8_t *)wsp + mp->object_size), + prio, + pf, + arg + }; - return chThdCreateStatic(wsp, mp->object_size, prio, pf, arg); + return chThdCreate(&td); } /** -- cgit v1.2.3