proxygen
|
Namespaces | |
detail | |
Classes | |
class | ABDCommitNotCalledException |
class | ABDTokenNotDispatchedException |
class | ABDUsageException |
class | AtomicBatchDispatcher |
class | BatchDispatcher |
class | Baton |
class | CacheManager |
class | EventBaseLoopController |
class | ExecutorLoopController |
class | Fiber |
Fiber object used by FiberManager to execute tasks. More... | |
class | FiberImpl |
class | FiberManager |
Single-threaded task execution engine. More... | |
struct | FirstArgOf |
struct | FirstArgOf< F, typename std::enable_if< std::is_class< F >::value >::type > |
struct | FirstArgOf< F, typename std::enable_if<!std::is_class< F >::value >::type > |
class | GuardPageAllocator |
class | InlineFunctionRunner |
struct | IsRvalueRefTry |
struct | IsRvalueRefTry< folly::Try< T > && > |
class | LocalType |
class | LoopController |
class | Promise |
class | Semaphore |
class | SimpleLoopController |
class | StackCache |
class | StackCacheEntry |
class | TaskIterator |
class | TimedMutex |
class | TimedRWMutex |
class | TimeoutController |
Typedefs | |
using | once_flag = basic_once_flag< TimedMutex > |
typedef Baton | GenericBaton |
Functions | |
template<class InputIterator > | |
TaskIterator< invoke_result_t< typename std::iterator_traits< InputIterator >::value_type > > | addTasks (InputIterator first, InputIterator last) |
template<typename InputT , typename ResultT > | |
AtomicBatchDispatcher< InputT, ResultT > | createAtomicBatchDispatcher (folly::Function< std::vector< ResultT >(std::vector< InputT > &&)> dispatchFunc, size_t initialCapacity) |
template<typename F > | |
FirstArgOf< F >::type::value_type | await (F &&func) |
bool | onFiber () |
template<typename F > | |
void | addTask (F &&func) |
template<typename F , typename G > | |
void | addTaskFinally (F &&func, G &&finally) |
template<typename F > | |
invoke_result_t< F > | runInMainContext (F &&func) |
template<typename T > | |
T & | local () |
void | yield () |
FiberManager & | getFiberManager (EventBase &evb, const FiberManager::Options &opts) |
FiberManager & | getFiberManager (VirtualEventBase &evb, const FiberManager::Options &opts) |
template<class InputIterator , class F > | |
void | forEach (InputIterator first, InputIterator last, F &&f) |
template<class InputIterator > | |
std::vector< typename std::enable_if< !std::is_same< invoke_result_t< typename std::iterator_traits< InputIterator >::value_type >, void >::value, typename std::pair< size_t, invoke_result_t< typename std::iterator_traits< InputIterator >::value_type > > >::type > | collectN (InputIterator first, InputIterator last, size_t n) |
template<class InputIterator > | |
std::enable_if< std::is_same< invoke_result_t< typename std::iterator_traits< InputIterator >::value_type >, void >::value, std::vector< size_t > >::type | collectN (InputIterator first, InputIterator last, size_t n) |
template<class InputIterator > | |
std::vector< typename std::enable_if< !std::is_same< invoke_result_t< typename std::iterator_traits< InputIterator >::value_type >, void >::value, invoke_result_t< typename std::iterator_traits< InputIterator >::value_type > >::type > | collectAll (InputIterator first, InputIterator last) |
template<class InputIterator > | |
std::enable_if< std::is_same< invoke_result_t< typename std::iterator_traits< InputIterator >::value_type >, void >::value, void >::type | collectAll (InputIterator first, InputIterator last) |
template<class InputIterator > | |
std::enable_if< !std::is_same< invoke_result_t< typename std::iterator_traits< InputIterator >::value_type >, void >::value, typename std::pair< size_t, invoke_result_t< typename std::iterator_traits< InputIterator >::value_type > > >::type | collectAny (InputIterator first, InputIterator last) |
template<class InputIterator > | |
std::enable_if< std::is_same< invoke_result_t< typename std::iterator_traits< InputIterator >::value_type >, void >::value, size_t >::type | collectAny (InputIterator first, InputIterator last) |
Variables | |
constexpr size_t | kNumGuarded = 100 |
constexpr size_t | kMaxInUse = 100 |
typedef Baton folly::fibers::GenericBaton |
Definition at line 25 of file GenericBaton.h.
using folly::fibers::once_flag = typedef basic_once_flag<TimedMutex> |
Definition at line 23 of file CallOnce.h.
|
inline |
Add a new task to be executed.
func | Task functor; must have a signature of void func() . The object will be destroyed once task execution is complete. |
Definition at line 529 of file FiberManagerInternal.h.
References folly::fibers::FiberManager::addTask(), and folly::fibers::FiberManager::getFiberManager().
Referenced by collectN(), forEach(), TEST(), and testFiberLocal().
|
inline |
Add a new task. When the task is complete, execute finally(Try<Result>&&) on the main context. Task functor is run and destroyed on the fiber context. Finally functor is run and destroyed on the main context.
func | Task functor; must have a signature of T func() for some T. |
finally | Finally functor; must have a signature of void finally(Try<T>&&) and will be passed the result of func() (including the exception if occurred). |
Definition at line 545 of file FiberManagerInternal.h.
References folly::fibers::FiberManager::addTaskFinally(), await(), and folly::fibers::FiberManager::getFiberManager().
Referenced by folly::fibers::FiberManager::add(), and folly::fibers::FiberManager::addTaskFuture().
|
inline |
Schedules several tasks and immediately returns an iterator, that allow one to traverse tasks in the order of their completion. All results and exceptions thrown are stored alongside with the task id and are accessible via iterator.
first | Range of tasks to be scheduled |
last |
Definition at line 114 of file AddTasks-inl.h.
References folly::fibers::TaskIterator< T >::addTask(), folly::gen::first, and folly::gen::move.
Referenced by TEST().
|
inline |
Blocks task execution until given promise is fulfilled.
Calls function passing in a Promise<T>, which has to be fulfilled.
Definition at line 557 of file FiberManagerInternal-inl.h.
References folly::fibers::Promise< T, BatonT >::await().
Referenced by addTaskFinally(), collectN(), Application::loop(), folly::fibers::TaskIterator< T >::reserve(), runBenchmark(), and TEST().
|
inline |
Schedules several tasks and blocks until all of these tasks are completed. If any of the tasks throws an exception, this exception will be re-thrown, but only when all the tasks are complete. If several tasks throw exceptions one of them will be re-thrown.
first | Range of tasks to be scheduled |
last |
Definition at line 147 of file WhenN-inl.h.
References forEach(), i, folly::gen::move, order, and folly::value().
Referenced by fizz::sm::getCertificateRequest(), and TEST().
|
inline |
collectAll specialization for functions returning void
first | Range of tasks to be scheduled |
last |
Definition at line 178 of file WhenN-inl.h.
References forEach(), type, and folly::value().
|
inline |
Schedules several tasks and blocks until one of them is completed. If this task throws an exception, this exception will be re-thrown. Exceptions thrown by all other tasks will be ignored.
first | Range of tasks to be scheduled |
last |
Definition at line 192 of file WhenN-inl.h.
References collectN(), folly::gen::move, and folly::value().
Referenced by TEST(), and testFiberLocal().
|
inline |
WhenAny specialization for functions returning void.
first | Range of tasks to be scheduled |
last |
Definition at line 204 of file WhenN-inl.h.
References collectN(), and folly::gen::move.
|
inline |
Schedules several tasks and blocks until n of these tasks are completed. If any of these n tasks throws an exception, this exception will be re-thrown, but only when n tasks are complete. If several tasks throw exceptions one of them will be re-thrown.
first | Range of tasks to be scheduled |
last | |
n | Number of tasks to wait for |
Definition at line 34 of file WhenN-inl.h.
References addTask(), await(), context, f, folly::gen::first, i, folly::gen::move, type, and folly::value().
Referenced by collectAny(), and TEST().
|
inline |
collectN specialization for functions returning void
first | Range of tasks to be scheduled |
last | |
n | Number of tasks to wait for |
Definition at line 91 of file WhenN-inl.h.
References addTask(), await(), context, f, folly::gen::first, i, folly::gen::move, type, and folly::value().
AtomicBatchDispatcher< InputT, ResultT > folly::fibers::createAtomicBatchDispatcher | ( | folly::Function< std::vector< ResultT >(std::vector< InputT > &&)> | dispatchFunc, |
size_t | initialCapacity | ||
) |
Definition at line 214 of file AtomicBatchDispatcher-inl.h.
References folly::gen::move, and folly::fibers::AtomicBatchDispatcher< InputT, ResultT >::reserve().
Referenced by TEST().
|
inline |
Schedules several tasks and blocks until all of them are completed. In the process of their successfull completion given callback would be called for each of them with the index of the task and the result it returned (if not void). If any of these n tasks throws an exception, this exception will be re-thrown, but only when all tasks are complete. If several tasks throw exceptions one of them will be re-thrown. Callback won't be called for tasks that throw exception.
first | Range of tasks to be scheduled |
last | |
F | callback to call for each result. In case of each task returning void it should be callable F(size_t id) otherwise should be callable F(size_t id, Result) |
Definition at line 41 of file ForEach-inl.h.
References addTask(), f, folly::gen::first, i, folly::gen::move, and folly::fibers::Baton::wait().
Referenced by collectAll(), and TEST().
FiberManager & folly::fibers::getFiberManager | ( | EventBase & | evb, |
const FiberManager::Options & | opts | ||
) |
Definition at line 183 of file FiberManagerMap.cpp.
References folly::pushmi::operators::get.
Referenced by folly::FiberIOExecutor::add(), BENCHMARK(), main(), folly::fibers::FiberManager::runQueueSize(), TEST(), and TEST_F().
FiberManager & folly::fibers::getFiberManager | ( | VirtualEventBase & | evb, |
const FiberManager::Options & | opts | ||
) |
Definition at line 189 of file FiberManagerMap.cpp.
References folly::pushmi::operators::get.
T& folly::fibers::local | ( | ) |
Returns a refference to a fiber-local context for given Fiber. Should be always called with the same T for each fiber. Fiber-local context is lazily default-constructed on first request. When new task is scheduled via addTask / addTaskRemote from a fiber its fiber-local context is copied into the new fiber.
Definition at line 584 of file FiberManagerInternal.h.
References folly::fibers::FiberManager::getFiberManagerUnsafe(), and folly::T.
Referenced by folly::fibers::FiberManager::add(), lifo_test(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::load(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::putOwnedBase(), folly::detail::ThreadCachedLists< Tag >::ListHead::splice(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::takeOwnedBase(), and folly::AsyncSocket::withAddr().
|
inline |
Definition at line 517 of file FiberManagerInternal.h.
References folly::fibers::FiberManager::getFiberManagerUnsafe().
Referenced by wangle::SSLSessionCacheManager::getSession(), folly::fibers::TimedMutex::lockHelper(), and TEST_F().
|
inline |
If called from a fiber, immediately switches to the FiberManager's context and runs func(), going back to the Fiber's context after completion. Outside a fiber, just calls func() directly.
Definition at line 568 of file FiberManagerInternal.h.
References folly::fibers::FiberManager::getFiberManagerUnsafe(), and UNLIKELY.
Referenced by folly::fibers::FiberManager::add(), folly::fibers::FiberManager::addTaskRemoteFuture(), folly::python::getFiberManager(), and TEST().
|
inline |
Definition at line 592 of file FiberManagerInternal.h.
References folly::fibers::FiberManager::getFiberManagerUnsafe().
Referenced by folly::SharedMutexImpl< true >::applyDeferredReaders(), folly::detail::atomic_hash_spin_wait(), atomicIncrBaseline(), BENCHMARK_RELATIVE(), ConcurrentFlowManySender::cancellation_test(), ConcurrentFlowSingleSender::cancellation_test(), contendedRW(), contendedUse(), contentionAtWidth(), folly::fibers::FiberManager::currentFiber(), folly::detail::LifoSemBase< BatonType, Atom >::decrOrPush(), folly::RelaxedConcurrentPriorityQueue< T, MayBlock, SupportsSize, PopBatch, ListTargetSize, Mutex, Atom >::grow(), folly::detail::LifoSemBase< BatonType, Atom >::incrOrPop(), folly::isSequencedExecutor(), liveClockWaitUntilTests(), folly::RWSpinLock::lock(), folly::detail::lock(), folly::RWSpinLock::lock_shared(), folly::RWSpinLock::lock_upgrade(), folly::MicroLockCore::lockSlowPath(), main(), FibYielder::operator()(), run_basic_tests(), runAllAndValidate(), runContendedReaders(), runMixed(), runPingPong(), runRemoteUnlock(), folly::detail::LifoSemBase< BatonType, Atom >::shutdown(), folly::detail::spin_yield_until(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::takeOwnedBase(), TEST(), TEST_F(), folly::sync_tests::testConcurrency(), folly::detail::LifoSemBase< BatonType, Atom >::tryRemoveNode(), folly::RWSpinLock::unlock_upgrade_and_lock(), folly::hazptr_domain< DeterministicAtomic >::wait_for_zero_bulk_reclaims(), folly::EventBase::waitUntilRunning(), and folly::SharedMutexImpl< true >::yieldWaitForZeroBits().
constexpr size_t folly::fibers::kMaxInUse = 100 |
Maximum number of allocator instances with guarded stacks enabled
Definition at line 53 of file GuardPageAllocator.cpp.
constexpr size_t folly::fibers::kNumGuarded = 100 |
Each stack with a guard page creates two memory mappings. Since this is a limited resource, we don't want to create too many of these.
The upper bound on total number of mappings created is kNumGuarded * kMaxInUse. Number of guarded stacks per allocator instance
Definition at line 48 of file GuardPageAllocator.cpp.
Referenced by folly::fibers::StackCache::giveBack(), and folly::fibers::StackCache::StackCache().