#pragma once
#include <cassert>
#include <folly/CPortability.h>
#include <folly/Memory.h>
#include <folly/Optional.h>
#include <folly/Portability.h>
#include <folly/ScopeGuard.h>
#include <folly/Try.h>
#include <folly/fibers/Baton.h>
#include <folly/fibers/Fiber.h>
#include <folly/fibers/LoopController.h>
#include <folly/fibers/Promise.h>
#include <folly/tracing/AsyncStack.h>
namespace folly {
namespace fibers {
namespace {
inline FiberManager::Options preprocessOptions(FiberManager::Options opts) { … }
template <class F>
FOLLY_NOINLINE invoke_result_t<F> runNoInline(F&& func) { … }
template <class Result, class F>
FOLLY_NOINLINE void tryEmplaceWithNoInline(
folly::Try<Result>& result, F&& func) { … }
}
inline void FiberManager::ensureLoopScheduled() { … }
inline void FiberManager::activateFiber(Fiber* fiber) { … }
inline void FiberManager::deactivateFiber(Fiber* fiber) { … }
inline void FiberManager::runReadyFiber(Fiber* fiber) { … }
inline void FiberManager::loopUntilNoReady() { … }
template <typename LoopFunc>
void FiberManager::runFibersHelper(LoopFunc&& loopFunc) { … }
inline size_t FiberManager::recordStackPosition(size_t position) { … }
inline void FiberManager::loopUntilNoReadyImpl() { … }
inline void FiberManager::runEagerFiber(Fiber* fiber) { … }
inline void FiberManager::runEagerFiberImpl(Fiber* fiber) { … }
inline bool FiberManager::shouldRunLoopRemote() { … }
inline bool FiberManager::hasReadyTasks() const { … }
template <typename F>
struct FiberManager::AddTaskHelper { … };
template <typename F>
Fiber* FiberManager::createTask(F&& func, TaskOptions taskOptions) { … }
template <typename F>
void FiberManager::addTask(F&& func, TaskOptions taskOptions) { … }
template <typename F>
void FiberManager::addTaskEager(F&& func) { … }
template <typename F>
void FiberManager::addTaskRemote(F&& func) { … }
template <typename X>
struct IsRvalueRefTry { … };
IsRvalueRefTry<folly::Try<T> &&>;
template <typename F, typename G>
struct FiberManager::AddTaskFinallyHelper { … };
template <typename F, typename G>
Fiber* FiberManager::createTaskFinally(F&& func, G&& finally) { … }
template <typename F, typename G>
void FiberManager::addTaskFinally(F&& func, G&& finally) { … }
template <typename F, typename G>
void FiberManager::addTaskFinallyEager(F&& func, G&& finally) { … }
template <typename F>
invoke_result_t<F> FiberManager::runInMainContext(F&& func) { … }
inline FiberManager& FiberManager::getFiberManager() { … }
inline FiberManager* FiberManager::getFiberManagerUnsafe() { … }
inline bool FiberManager::hasActiveFiber() const { … }
inline folly::Optional<std::chrono::nanoseconds>
FiberManager::getCurrentTaskRunningTime() const { … }
inline void FiberManager::yield() { … }
template <typename T>
T& FiberManager::local() { … }
template <typename T>
T& FiberManager::localThread() { … }
inline void FiberManager::initLocalData(Fiber& fiber) { … }
template <typename LocalT>
FiberManager::FiberManager(
LocalType<LocalT>,
std::unique_ptr<LoopController> loopController__,
Options options)
: loopController_(std::move(loopController__)),
stackAllocator_(options.guardPagesPerStack),
options_(preprocessOptions(std::move(options))),
exceptionCallback_(defaultExceptionCallback),
fibersPoolResizer_(*this),
localType_(typeid(LocalT)) { … }
template <typename F>
typename FirstArgOf<F>::type::value_type inline await_async(F&& func) { … }
template <typename F>
invoke_result_t<F> inline runInMainContext(F&& func) { … }
}
}