@@ -13,10 +13,12 @@ * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ +#include + bool of_mutex_new(of_mutex_t *mutex) { InitializeCriticalSection(mutex); @@ -32,11 +34,16 @@ } bool of_mutex_trylock(of_mutex_t *mutex) { - return TryEnterCriticalSection(mutex); + if (!TryEnterCriticalSection(mutex)) { + errno = EBUSY; + return false; + } + + return true; } bool of_mutex_unlock(of_mutex_t *mutex) {