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_PlatformRWLock_h
8 #define mozilla_PlatformRWLock_h
10 #include "mozilla/Types.h"
16 namespace mozilla::detail
{
20 explicit MFBT_API
RWLockImpl();
21 MFBT_API
~RWLockImpl();
24 [[nodiscard
]] MFBT_API
bool tryReadLock();
25 MFBT_API
void readLock();
26 MFBT_API
void readUnlock();
28 [[nodiscard
]] MFBT_API
bool tryWriteLock();
29 MFBT_API
void writeLock();
30 MFBT_API
void writeUnlock();
33 RWLockImpl(const RWLockImpl
&) = delete;
34 void operator=(const RWLockImpl
&) = delete;
35 RWLockImpl(RWLockImpl
&&) = delete;
36 void operator=(RWLockImpl
&&) = delete;
37 bool operator==(const RWLockImpl
& rhs
) = delete;
40 pthread_rwlock_t mRWLock
;
42 // SRWLock is pointer-sized. We declare it in such a fashion here to avoid
43 // pulling in windows.h wherever this header is used.
48 } // namespace mozilla::detail
50 #endif // mozilla_PlatformRWLock_h