1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #include "mozilla/Assertions.h"
11 bool Mutex::TryLock() {
13 return !!TryEnterCriticalSection(&mMutex
);
14 #elif defined(XP_DARWIN)
15 return os_unfair_lock_trylock(&mMutex
);
17 switch (pthread_mutex_trylock(&mMutex
)) {
23 MOZ_CRASH("pthread_mutex_trylock error.");