Mutex_noop.cpp (1061B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include <errno.h> 8 9 #include "mozilla/PlatformMutex.h" 10 #include "MutexPlatformData_noop.h" 11 12 mozilla::detail::MutexImpl::MutexImpl() {} 13 14 mozilla::detail::MutexImpl::~MutexImpl() {} 15 16 inline void mozilla::detail::MutexImpl::mutexLock() {} 17 18 bool mozilla::detail::MutexImpl::tryLock() { return mutexTryLock(); } 19 20 bool mozilla::detail::MutexImpl::mutexTryLock() { return true; } 21 22 void mozilla::detail::MutexImpl::lock() { mutexLock(); } 23 24 void mozilla::detail::MutexImpl::unlock() {} 25 26 mozilla::detail::MutexImpl::PlatformData* 27 mozilla::detail::MutexImpl::platformData() { 28 static_assert(sizeof(platformData_) >= sizeof(PlatformData), 29 "platformData_ is too small"); 30 return reinterpret_cast<PlatformData*>(platformData_); 31 }