proxygen
folly::InlineExecutor Class Reference

#include <InlineExecutor.h>

Inheritance diagram for folly::InlineExecutor:
folly::Executor

Public Member Functions

void add (Func f) override
 
- Public Member Functions inherited from folly::Executor
virtual ~Executor ()
 
virtual void addWithPriority (Func, int8_t priority)
 
virtual uint8_t getNumPriorities () const
 

Static Public Member Functions

FOLLY_ATTR_VISIBILITY_HIDDEN static FOLLY_ALWAYS_INLINE InlineExecutorinstance () noexcept
 
- Static Public Member Functions inherited from folly::Executor
template<typename ExecutorT >
static KeepAlive< ExecutorT > getKeepAliveToken (ExecutorT *executor)
 
template<typename ExecutorT >
static KeepAlive< ExecutorT > getKeepAliveToken (ExecutorT &executor)
 

Static Private Member Functions

static FOLLY_COLD InlineExecutorinstance_slow () noexcept
 

Static Private Attributes

static std::atomic< InlineExecutor * > cache
 

Additional Inherited Members

- Static Public Attributes inherited from folly::Executor
static const int8_t LO_PRI = SCHAR_MIN
 
static const int8_t MID_PRI = 0
 
static const int8_t HI_PRI = SCHAR_MAX
 
- Protected Member Functions inherited from folly::Executor
virtual bool keepAliveAcquire ()
 
virtual void keepAliveRelease ()
 
- Static Protected Member Functions inherited from folly::Executor
template<typename ExecutorT >
static bool isKeepAliveDummy (const KeepAlive< ExecutorT > &keepAlive)
 
template<typename ExecutorT >
static KeepAlive< ExecutorT > makeKeepAlive (ExecutorT *executor)
 

Detailed Description

When work is "queued", execute it immediately inline. Usually when you think you want this, you actually want a QueuedImmediateExecutor.

Definition at line 30 of file InlineExecutor.h.

Member Function Documentation

void folly::InlineExecutor::add ( Func  )
inlineoverridevirtual

Enqueue a function to executed by this executor. This and all variants must be threadsafe.

Implements folly::Executor.

Definition at line 38 of file InlineExecutor.h.

References f, FOLLY_COLD, instance_slow(), and folly::pushmi::__adl::noexcept().

Referenced by TEST().

38  {
39  f();
40  }
auto f
InlineExecutor & folly::InlineExecutor::instance_slow ( )
staticprivatenoexcept

Definition at line 23 of file InlineExecutor.cpp.

References cache, and instance().

Referenced by add(), and instance().

23  {
24  static auto instance = Indestructible<InlineExecutor>{};
25  cache.store(&*instance, std::memory_order_release);
26  return *instance;
27 }
static std::atomic< InlineExecutor * > cache
FOLLY_ATTR_VISIBILITY_HIDDEN static FOLLY_ALWAYS_INLINE InlineExecutor & instance() noexcept

Member Data Documentation

std::atomic< InlineExecutor * > folly::InlineExecutor::cache
staticprivate

Definition at line 45 of file InlineExecutor.h.

Referenced by instance(), and instance_slow().


The documentation for this class was generated from the following files: