proxygen
PriorityExecutor Struct Reference
Inheritance diagram for PriorityExecutor:
folly::Executor

Public Member Functions

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

Public Attributes

int count0 {0}
 
int count1 {0}
 
int count2 {0}
 

Additional Inherited Members

- 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 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

Definition at line 197 of file ViaTest.cpp.

Member Function Documentation

void PriorityExecutor::add ( Func  )
inlineoverride

Definition at line 198 of file ViaTest.cpp.

198 {}
void PriorityExecutor::addWithPriority ( Func  f,
int8_t  priority 
)
inlineoverride

Definition at line 200 of file ViaTest.cpp.

References EXPECT_GE, EXPECT_LT, f, max, and min.

200  {
201  int mid = getNumPriorities() / 2;
202  int p = priority < 0 ? std::max(0, mid + priority)
203  : std::min(getNumPriorities() - 1, mid + priority);
204  EXPECT_LT(p, 3);
205  EXPECT_GE(p, 0);
206  if (p == 0) {
207  count0++;
208  } else if (p == 1) {
209  count1++;
210  } else if (p == 2) {
211  count2++;
212  }
213  f();
214  }
auto f
LogLevel max
Definition: LogLevel.cpp:31
STL namespace.
#define EXPECT_GE(val1, val2)
Definition: gtest.h:1932
uint8_t getNumPriorities() const override
Definition: ViaTest.cpp:216
LogLevel min
Definition: LogLevel.cpp:30
#define EXPECT_LT(val1, val2)
Definition: gtest.h:1930
uint8_t PriorityExecutor::getNumPriorities ( ) const
inlineoverridevirtual

Reimplemented from folly::Executor.

Definition at line 216 of file ViaTest.cpp.

216  {
217  return 3;
218  }

Member Data Documentation

int PriorityExecutor::count0 {0}

Definition at line 220 of file ViaTest.cpp.

Referenced by TEST().

int PriorityExecutor::count1 {0}

Definition at line 221 of file ViaTest.cpp.

Referenced by TEST().

int PriorityExecutor::count2 {0}

Definition at line 222 of file ViaTest.cpp.

Referenced by TEST().


The documentation for this struct was generated from the following file: