diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
| commit | f21a844f60ae6c74fcf1fddca32461acce3c1ee0 (patch) | |
| tree | 56d79f94966870db1cecd65a7264510a25fd1cba /include/lldb/Utility/RefCounter.h | |
| parent | 37d22554be9f5a677dad2a95b7ef22fe59c66a8a (diff) | |
Import lldb as of SVN r194122vendor/lldb/lldb-r194122
Sponsored by: DARPA, AFRL
Notes
svn path=/vendor/lldb/dist/; revision=257752
svn path=/vendor/lldb/lldb-r194122/; revision=257753; tag=vendor/lldb/lldb-r194122
Diffstat (limited to 'include/lldb/Utility/RefCounter.h')
| -rw-r--r-- | include/lldb/Utility/RefCounter.h | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/include/lldb/Utility/RefCounter.h b/include/lldb/Utility/RefCounter.h deleted file mode 100644 index 6daed5498eb8..000000000000 --- a/include/lldb/Utility/RefCounter.h +++ /dev/null @@ -1,56 +0,0 @@ -//===-- RefCounter.h --------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_RefCounter_h_ -#define liblldb_RefCounter_h_ - -#include "lldb/lldb-public.h" - -namespace lldb_utility { - -//---------------------------------------------------------------------- -// A simple reference counter object. You need an uint32_t* to use it -// Once that is in place, everyone who needs to ref-count, can say -// RefCounter ref(ptr); -// (of course, the pointer is a shared resource, and must be accessible to -// everyone who needs it). Synchronization is handled by RefCounter itself -// The counter is decreased each time a RefCounter to it goes out of scope -//---------------------------------------------------------------------- -class RefCounter -{ -public: - typedef uint32_t value_type; - - RefCounter(value_type* ctr); - - ~RefCounter(); - -private: - value_type* m_counter; - DISALLOW_COPY_AND_ASSIGN (RefCounter); - - template <class T> - inline T - increment(T* t) - { - return __sync_fetch_and_add(t, 1); - } - - template <class T> - inline T - decrement(T* t) - { - return __sync_fetch_and_add(t, -1); - } - -}; - -} // namespace lldb_utility - -#endif // #ifndef liblldb_RefCounter_h_ |
