Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 LulRWLock_h
8 #define LulRWLock_h
10 #include "LulPlatformMacros.h"
11 #include <pthread.h>
13 // This class provides a simple wrapper around reader-writer locks.
14 // This is necessary because Android 2.2's libpthread does not
15 // provide such functionality, so there has to be a way to provide
16 // an alternative with an equivalent interface.
18 namespace lul {
20 class LulRWLock {
22 public:
23 LulRWLock();
24 ~LulRWLock();
25 void WrLock();
26 void RdLock();
27 void Unlock();
29 private:
30 #if defined(LUL_OS_android)
31 pthread_mutex_t mLock;
32 #elif defined(LUL_OS_linux)
33 pthread_rwlock_t mLock;
34 #else
35 # error "Unsupported OS"
36 #endif
38 };
40 } // namespace lul
42 #endif // LulRWLock_h