FS-7894: On Windows, use critical sections instead of mutexes. (Mutexes on Windows are cross-process, unlike lightweight Linux futexes.)

This commit is contained in:
Michael Giagnocavo 2015-07-26 20:02:22 -06:00
parent 17241c8bcd
commit c599f4f447
1 changed files with 5 additions and 0 deletions

View File

@ -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);
}