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

Unified Diff: native_client_sdk/src/libraries/c_salt/threading/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 side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/libraries/c_salt/threading/ref_count.h
diff --git a/native_client_sdk/src/libraries/c_salt/threading/ref_count.h b/native_client_sdk/src/libraries/c_salt/threading/ref_count.h
deleted file mode 100644
index 0efae61513c08d7620c8830c7573725646b9b267..0000000000000000000000000000000000000000
--- a/native_client_sdk/src/libraries/c_salt/threading/ref_count.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#ifndef REF_COUNT_H_
-#define REF_COUNT_H_
-
-#include "c_salt/threading/pthread_ext.h"
-
-namespace threading {
-
-// A thread-safe reference counter for class CompletionCallbackFactory.
-class RefCount {
- public:
- RefCount() : ref_(0) {
- pthread_mutex_init(&mutex_, NULL);
- }
- ~RefCount() {
- pthread_mutex_destroy(&mutex_);
- }
-
- int32_t AddRef() {
- int32_t ret_val = 0;
- if (pthread_mutex_lock(&mutex_) == PTHREAD_MUTEX_SUCCESS) {
- ret_val = ++ref_;
- pthread_mutex_unlock(&mutex_);
- }
- return ret_val;
- }
-
- int32_t Release() {
- int32_t ret_val = -1;
- if (pthread_mutex_lock(&mutex_) == PTHREAD_MUTEX_SUCCESS) {
- ret_val = --ref_;
- pthread_mutex_unlock(&mutex_);
- }
- return ret_val;
- }
-
- private:
- int32_t ref_;
- pthread_mutex_t mutex_;
-};
-
-} // namespace threading
-#endif // REF_COUNT_H_
-

Powered by Google App Engine
This is Rietveld 408576698