Explorar o código

pthread: fix the priority inheritance (backport v3.3)

xutao %!s(int64=5) %!d(string=hai) anos
pai
achega
cf4eba2f5d
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      components/pthread/pthread.c

+ 9 - 0
components/pthread/pthread.c

@@ -591,6 +591,15 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex)
         return EBUSY;
     }
 
+    if (mux->type == PTHREAD_MUTEX_RECURSIVE) {
+        res = xSemaphoreGiveRecursive(mux->sem);
+    } else {
+        res = xSemaphoreGive(mux->sem);
+    }
+    if (res != pdTRUE) {
+        assert(false && "Failed to release mutex!");
+    }
+
     vSemaphoreDelete(mux->sem);
     free(mux);