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

Unified Diff: experimental/hex/thread_safe_ref_count.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 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
« no previous file with comments | « experimental/hex/thread_condition.h ('k') | experimental/linux_debug_server/debugger/base/debug_blob.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/hex/thread_safe_ref_count.h
diff --git a/experimental/hex/thread_safe_ref_count.h b/experimental/hex/thread_safe_ref_count.h
deleted file mode 100644
index bd9c67f1c3075a89a75a30e2cb81742dad9b13d1..0000000000000000000000000000000000000000
--- a/experimental/hex/thread_safe_ref_count.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2011 The Native Client 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 THREAD_SAFE_REF_COUNT_H
-#define THREAD_SAFE_REF_COUNT_H
-
-#include <pthread.h>
-#include <cassert>
-
-const int kPthreadMutexSuccess = 0;
-
-namespace {
-// Some synchronization helper classes.
-
-class ScopedLock {
- public:
- explicit ScopedLock(pthread_mutex_t* mutex)
- : mutex_(mutex) {
- if (pthread_mutex_lock(mutex_) != kPthreadMutexSuccess) {
- mutex_ = NULL;
- }
- }
- ~ScopedLock() {
- if (mutex_ != NULL) {
- pthread_mutex_unlock(mutex_);
- }
- }
- private:
- ScopedLock& operator=(const ScopedLock&); // Not implemented, do not use.
- ScopedLock(const ScopedLock&); // Not implemented, do not use.
- pthread_mutex_t* mutex_; // Weak reference, passed in to constructor.
-};
-
-class ThreadSafeRefCount {
- public:
- ThreadSafeRefCount()
- : ref_(0) {
- Init();
- }
-
- void Init() {
- pthread_mutex_init(&mutex_, NULL);
- }
-
- int32_t AddRef() {
- ScopedLock s(&mutex_);
- return ++ref_;
- }
-
- int32_t Release() {
- ScopedLock s(&mutex_);
- return --ref_;
- }
-
- private:
- int32_t ref_;
- pthread_mutex_t mutex_;
-};
-
-} // namespace
-#endif // THREAD_SAFE_REF_COUNT_H
-
« no previous file with comments | « experimental/hex/thread_condition.h ('k') | experimental/linux_debug_server/debugger/base/debug_blob.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698