Skip to content
  • deuce's avatar
    Prevent mutex and semaphore leaks: · e84e7947
    deuce authored
    To prevent mutex leaks, lock the mutex before destroying it...
    To prevent sem leaks, if the return value is -1 and the sem is not invalid,
    wait, post, retry.
    
    Unfortunately, POSIX doesn't define the behaviour or sem_destroy() if called
    while there are threads blocked on sem... luckily, we rarely use POSIX sems.
    e84e7947