Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(663)

Side by Side Diff: native_client_sdk/src/libraries/sdk_util/simple_lock.h

Issue 18644009: [NaCl SDK] Upate atomic ops in nacl_io (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 'Move comment to correct location' Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6 #ifndef LIBRARIES_SDK_UTIL_SIMPLE_LOCK_H_
7 #define LIBRARIES_SDK_UTIL_SIMPLE_LOCK_H_
8
9 #include "pthread.h"
10 #include "sdk_util/macros.h"
11
12 /*
13 * SimpleLock
14 *
15 * A pthread mutex object, with automatic initialization and destruction.
16 * Should be used with AutoLock where possible.
17 */
18 class SimpleLock {
19 public:
20 SimpleLock() {
21 pthread_mutex_init(&lock_, NULL);
22 }
23
24 ~SimpleLock() {
25 pthread_mutex_destroy(&lock_);
26 }
27
28 pthread_mutex_t* mutex() const { return &lock_; }
29
30 private:
31 mutable pthread_mutex_t lock_;
32 friend class AutoLock;
binji 2013/07/13 00:16:48 doesn't need to be a friend now, does it?
33
34 DISALLOW_COPY_AND_ASSIGN(SimpleLock);
35 };
36
37 #endif // LIBRARIES_SDK_UTIL_SIMPLE_LOCK_H_
38
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698