Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
once.h File Reference
#include <functional>
#include "base/integral_types.h"
#include "base/macros.h"
#include "ion/base/staticsafedeclare.h"
#include "ion/port/atomic.h"
#include "ion/port/macros.h"
#include "ion/port/threadutils.h"
Include dependency graph for once.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ion::base::OnceFlag
 OnceFlag ensures that a target function is only evaluated once. More...
 
class  ion::base::Lazy< T >
 Lazily populates a value. More...
 

Namespaces

 ion
 Copyright 2016 Google Inc.
 
 ion::base
 EnumHelper instantiations. These must be in the ion::base namespace.
 

Macros

#define ION_STATIC_ONCE_CHECKED(function)   ION_STATIC_ONCE(std::bind(::ion::base::OnceFlag::CallChecked, &function));
 Executes a given static bool() function exactly once. More...
 
#define ION_STATIC_ONCE(function)
 Executes a given static void() or T() function exactly once. More...
 

Macro Definition Documentation

#define ION_STATIC_ONCE (   function)
Value:
do { \
s_once_flag_macro->CallOnce(function); \
} while (0)
#define ION_DECLARE_SAFE_STATIC_POINTER(type, variable)
Declare a static non-array pointer and calls a default constructor.
OnceFlag ensures that a target function is only evaluated once.
Definition: once.h:38

Executes a given static void() or T() function exactly once.

Any return type is ignored.

Definition at line 133 of file once.h.

#define ION_STATIC_ONCE_CHECKED (   function)    ION_STATIC_ONCE(std::bind(::ion::base::OnceFlag::CallChecked, &function));

Executes a given static bool() function exactly once.

Logs an error if the function returns false.

Definition at line 128 of file once.h.