Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
staticsafedeclare.cc
Go to the documentation of this file.
1 
19 
20 #include "ion/base/logging.h"
21 
22 namespace ion {
23 namespace base {
24 
31 }
32 
35  LockGuard locker(&mutex_);
37  for (int i = static_cast<int>(deleters_.size()) - 1; i >= 0; --i)
38  delete deleters_[i];
39 }
40 
41 void StaticDeleterDeleter::SetInstancePtr(
42  const std::string&, StaticDeleterDeleter* instance) {
50  static SharedPtr<StaticDeleterDeleter> s_singleton_holder;
51  s_singleton_holder.Reset(instance);
52 }
53 
56  new StaticDeleterDeleter, SetInstancePtr,
57  delete);
58  return singleton_ptr;
59 }
60 
62  SetInstancePtr("StaticDeleterDeleter", NULL);
63 }
64 
65 } // namespace base
66 } // namespace ion
StaticDeleterDeleter is an internal class that holds and deletes StaticDeleters; it should not be use...
port::LogEntryWriter * GetDefaultLogEntryWriter()
Returns the log-writer that messages will be logged to if if another is not explicitly specified via ...
Definition: logging.cc:197
static void DestroyInstance()
Call this function once, and only once, at the end of a program, to explicitly destroy all StaticDele...
#define ION_DECLARE_SAFE_STATIC(type, variable, constructor, add_func, destroyer)
Declares and thread-safely assigns the value of a static variable.
A LockGuard locks a mutex when created, and unlocks it when destroyed.
Definition: lockguards.h:90
Copyright 2016 Google Inc.
void Reset(T *new_shared)
Changes the pointer to point to the given shared, which may be NULL.
Definition: sharedptr.h:92
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
Definition: sharedptr.h:60
static StaticDeleterDeleter * GetInstance()
Returns a pointer to the global instance.