From: Michael Giagnocavo Date: Mon, 27 Jul 2015 02:02:22 +0000 (-0600) Subject: FS-7894: On Windows, use critical sections instead of mutexes. (Mutexes on Windows... X-Git-Tag: v1.6.2~211^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c599f4f44701af865283f33eb0100d395fa77c7f;p=thirdparty%2Ffreeswitch.git FS-7894: On Windows, use critical sections instead of mutexes. (Mutexes on Windows are cross-process, unlike lightweight Linux futexes.) --- diff --git a/src/switch_apr.c b/src/switch_apr.c index f1f64df360..81b448eba5 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -269,6 +269,11 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsigned int flags, switch_memory_pool_t *pool) { +#ifdef WIN32 + /* Old version of APR misunderstands mutexes. On Windows, mutexes are cross-process. + APR has no reason to not use critical sections instead of mutexes. */ + if (flags == SWITCH_MUTEX_NESTED) flags = SWITCH_MUTEX_DEFAULT; +#endif return apr_thread_mutex_create(lock, flags, pool); }