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/. */
7 #ifndef mozilla_PlatformMutex_h
8 #define mozilla_PlatformMutex_h
12 #include "mozilla/Attributes.h"
22 class ConditionVariableImpl
;
28 explicit MFBT_API
MutexImpl();
29 MFBT_API
~MutexImpl();
33 MFBT_API
void unlock();
34 // We have a separate, forwarding API so internal uses don't have to go
36 MFBT_API
bool tryLock();
39 MutexImpl(const MutexImpl
&) = delete;
40 void operator=(const MutexImpl
&) = delete;
41 MutexImpl(MutexImpl
&&) = delete;
42 void operator=(MutexImpl
&&) = delete;
43 bool operator==(const MutexImpl
& rhs
) = delete;
48 PlatformData
* platformData();
51 void* platformData_
[sizeof(pthread_mutex_t
) / sizeof(void*)];
52 static_assert(sizeof(pthread_mutex_t
) / sizeof(void*) != 0 &&
53 sizeof(pthread_mutex_t
) % sizeof(void*) == 0,
54 "pthread_mutex_t must have pointer alignment");
56 void* platformData_
[6];
59 friend class mozilla::detail::ConditionVariableImpl
;
64 } // namespace mozilla
66 #endif // mozilla_PlatformMutex_h