blob: 26c8d1ffd88377b488d694e198f35164b6feda48 [file] [log] [blame]
Greg Claytone49f79d2010-06-12 17:45:57 +00001//===---------------------SharingPtr.cpp ------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Eli Friedman17b71362010-06-12 18:29:53 +000010#include "lldb/Utility/SharingPtr.h"
Greg Claytone49f79d2010-06-12 17:45:57 +000011
Greg Clayton6a5aa8a2010-09-24 23:07:41 +000012namespace lldb_private {
Greg Claytone49f79d2010-06-12 17:45:57 +000013
14namespace imp
15{
16
Greg Clayton6e0101c2011-09-17 06:21:20 +000017
18 shared_count::~shared_count()
19 {
20 }
21
22 void
23 shared_count::add_shared()
24 {
25 increment(shared_owners_);
26 }
27
28 void
29 shared_count::release_shared()
30 {
31 if (decrement(shared_owners_) == -1)
32 {
33 on_zero_shared();
34 delete this;
35 }
36 }
Greg Claytone49f79d2010-06-12 17:45:57 +000037
38} // imp
39
Greg Clayton6e0101c2011-09-17 06:21:20 +000040
Greg Claytone49f79d2010-06-12 17:45:57 +000041} // namespace lldb
Greg Clayton6e0101c2011-09-17 06:21:20 +000042