From 3e6e47ee7dfea369d865bef41dc59e7fbdff6e8a Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Thu, 25 Feb 2016 14:22:55 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8947 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/abstractions/nasa_osal/src/osapi.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/os/common/abstractions/nasa_osal/src/osapi.c b/os/common/abstractions/nasa_osal/src/osapi.c index f192a35e0..a367c339b 100644 --- a/os/common/abstractions/nasa_osal/src/osapi.c +++ b/os/common/abstractions/nasa_osal/src/osapi.c @@ -1312,11 +1312,15 @@ int32 OS_TaskCreate(uint32 *task_id, error code is not very appropriate but this case seems to not be coveded by the specification.*/ if ((tp = chRegFindThreadByWorkingArea((stkalign_t *)stack_pointer)) != NULL) { + /* Releasing the thread reference.*/ + chThdRelease(tp); return OS_ERR_NO_FREE_IDS; } /* Checking if the name is already in use.*/ if ((tp = chRegFindThreadByName(task_name)) != NULL) { + /* Releasing the thread reference.*/ + chThdRelease(tp); return OS_ERR_NAME_TAKEN; } @@ -1390,6 +1394,9 @@ int32 OS_TaskDelete(uint32 task_id) { ((funcptr_t)(tp->osal_delete_handler))(); } + /* Releasing the thread reference.*/ + chThdRelease(tp); + return OS_SUCCESS; } @@ -1490,6 +1497,9 @@ int32 OS_TaskSetPriority(uint32 task_id, uint32 new_priority) { chSchRescheduleS(); chSysUnlock(); + /* Releasing the thread reference.*/ + chThdRelease(tp); + return OS_SUCCESS; } @@ -1549,6 +1559,9 @@ int32 OS_TaskGetIdByName(uint32 *task_id, const char *task_name) { *task_id = (uint32)tp; + /* Releasing the thread reference.*/ + chThdRelease(tp); + return OS_SUCCESS; } @@ -1585,6 +1598,9 @@ int32 OS_TaskGetInfo(uint32 task_id, OS_task_prop_t *task_prop) { task_prop->priority = (uint32)256U - (uint32)tp->realprio; task_prop->OStask_id = task_id; + /* Releasing the thread reference.*/ + chThdRelease(tp); + return OS_SUCCESS; }