From 2378bce7f6ecaeac4c8b9075c97f2211e2185844 Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Fri, 7 Apr 2000 17:21:39 +0000 Subject: [PATCH] Try harder to destroy mutex semaphores. If an attempt to destroy one fails because it is locked, try again after unlocking it. This won't work if the thread has recursively locked the mutex, but it seems to be fine for all the cases the EPICS uses. --- src/libCom/osi/os/RTEMS/osdSem.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libCom/osi/os/RTEMS/osdSem.c b/src/libCom/osi/os/RTEMS/osdSem.c index 6a0067502..e84bf2d79 100644 --- a/src/libCom/osi/os/RTEMS/osdSem.c +++ b/src/libCom/osi/os/RTEMS/osdSem.c @@ -216,7 +216,16 @@ semMutexId semMutexMustCreate(void) void semMutexDestroy(semMutexId id) { - semBinaryDestroy (id); + rtems_id sid = (rtems_id)id; + rtems_status_code sc; + + sc = rtems_semaphore_delete (sid); + if (sc == RTEMS_RESOURCE_IN_USE) { + rtems_semaphore_release (sid); + sc = rtems_semaphore_delete (sid); + } + if (sc != RTEMS_SUCCESSFUL) + errlogPrintf ("Can't destroy semaphore: %s\n", rtems_status_text (sc)); } void semMutexGive(semMutexId id)