proxygen
AtomicBatchDispatcherTesting::Job Struct Reference

Public Member Functions

void preprocess (FiberManager &executor, bool die)
 
 Job (AtomicBatchDispatcher< ValueT, ResultT >::Token &&t, ValueT i)
 
 Job (Job &&)=default
 
Joboperator= (Job &&)=default
 

Public Attributes

AtomicBatchDispatcher< ValueT, ResultT >::Token token
 
ValueT input
 

Detailed Description

Definition at line 1790 of file FibersTest.cpp.

Constructor & Destructor Documentation

AtomicBatchDispatcherTesting::Job::Job ( AtomicBatchDispatcher< ValueT, ResultT >::Token &&  t,
ValueT  i 
)
inline

Definition at line 1807 of file FibersTest.cpp.

1808  : token(std::move(t)), input(i) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
AtomicBatchDispatcher< ValueT, ResultT >::Token token
AtomicBatchDispatcherTesting::Job::Job ( Job &&  )
default

Member Function Documentation

Job& AtomicBatchDispatcherTesting::Job::operator= ( Job &&  )
default
void AtomicBatchDispatcherTesting::Job::preprocess ( FiberManager executor,
bool  die 
)
inline

Definition at line 1794 of file FibersTest.cpp.

References folly::Random::rand32(), start, and folly::fibers::FiberManager::yield().

Referenced by AtomicBatchDispatcherTesting::dispatchJobs().

1794  {
1795  // Yield for a random duration [0, 10] ms to simulate I/O in preprocessing
1796  clock_t msecToDoIO = folly::Random::rand32() % 10;
1797  double start = (1000.0 * clock()) / CLOCKS_PER_SEC;
1798  double endAfter = start + msecToDoIO;
1799  while ((1000.0 * clock()) / CLOCKS_PER_SEC < endAfter) {
1800  executor.yield();
1801  }
1802  if (die) {
1803  throw std::logic_error("Simulating preprocessing failure");
1804  }
1805  }
auto start
static uint32_t rand32()
Definition: Random.h:213

Member Data Documentation

ValueT AtomicBatchDispatcherTesting::Job::input

Definition at line 1792 of file FibersTest.cpp.

Referenced by AtomicBatchDispatcherTesting::dispatchJobs().

AtomicBatchDispatcher<ValueT, ResultT>::Token AtomicBatchDispatcherTesting::Job::token

Definition at line 1791 of file FibersTest.cpp.

Referenced by AtomicBatchDispatcherTesting::dispatchJobs().


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