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

Side by Side Diff: native_client_sdk/src/libraries/gtest_ppapi/ref_count.h

Issue 10854137: [NaCl SDK] gtest_ppapi library. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove hacks Created 8 years, 4 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #ifndef REF_COUNT_H_ 4 #ifndef GTEST_PPAPI_REF_COUNT_H_
5 #define REF_COUNT_H_ 5 #define GTEST_PPAPI_REF_COUNT_H_
6 6
7 #include "c_salt/threading/pthread_ext.h" 7 #include "gtest_ppapi/pthread_ext.h"
8
9 namespace threading {
10 8
11 // A thread-safe reference counter for class CompletionCallbackFactory. 9 // A thread-safe reference counter for class CompletionCallbackFactory.
12 class RefCount { 10 class RefCount {
13 public: 11 public:
14 RefCount() : ref_(0) { 12 RefCount() : ref_(0) {
15 pthread_mutex_init(&mutex_, NULL); 13 pthread_mutex_init(&mutex_, NULL);
16 } 14 }
17 ~RefCount() { 15 ~RefCount() {
18 pthread_mutex_destroy(&mutex_); 16 pthread_mutex_destroy(&mutex_);
19 } 17 }
(...skipping 14 matching lines...) Expand all
34 pthread_mutex_unlock(&mutex_); 32 pthread_mutex_unlock(&mutex_);
35 } 33 }
36 return ret_val; 34 return ret_val;
37 } 35 }
38 36
39 private: 37 private:
40 int32_t ref_; 38 int32_t ref_;
41 pthread_mutex_t mutex_; 39 pthread_mutex_t mutex_;
42 }; 40 };
43 41
44 } // namespace threading 42 #endif // GTEST_PPAPI_REF_COUNT_H_
45 #endif // REF_COUNT_H_
46
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698