[libBasic] Add documentation comments for ThreadSafeRefCounted.h

Swift SVN r9654
This commit is contained in:
Argyrios Kyrtzidis
2013-10-24 21:33:22 +00:00
parent b7d3a23518
commit bb068725b4
2 changed files with 15 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
//===--- ThreadSafeRefCounted.h - -------------------------------*- C++ -*-===//
//===--- ThreadSafeRefCounted.h - Thread-safe Refcounting Base --*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
@@ -9,8 +9,6 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_BASIC_THREADSAFEREFCOUNTED_H
#define SWIFT_BASIC_THREADSAFEREFCOUNTED_H
@@ -20,7 +18,13 @@
namespace swift {
/// \brief A thread-safe version of llvm::RefCountedBase.
/// A thread-safe version of \c llvm::RefCountedBase.
///
/// A generic base class for objects that wish to have their lifetimes managed
/// using reference counts. Classes subclass \c ThreadSafeRefCountedBase to
/// obtain such functionality, and are typically handled with
/// \c IntrusiveRefCntPtr "smart pointers" which automatically handle the
/// management of reference counts.
/// FIXME: This should eventually move to llvm.
template <class Derived>
class ThreadSafeRefCountedBase {
@@ -41,6 +45,12 @@ public:
}
};
/// A class that has the same function as \c ThreadSafeRefCountedBase, but with
/// a virtual destructor.
///
/// Should be used instead of \c ThreadSafeRefCountedBase for classes that
/// already have virtual methods to enforce dynamic allocation via 'new'.
/// FIXME: This should eventually move to llvm.
class ThreadSafeRefCountedBaseVPTR {
mutable llvm::sys::cas_flag ref_cnt;
virtual void anchor();