/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <functional> #include <thread> #include <typeinfo> #include <folly/AtomicIntrusiveLinkedList.h> #include <folly/CPortability.h> #include <folly/Function.h> #include <folly/IntrusiveList.h> #include <folly/Portability.h> #include <folly/fibers/BoostContextCompatibility.h> #include <folly/io/async/Request.h> #include <folly/lang/Thunk.h> #include <folly/portability/PThread.h> // include after CPortability.h defines this #ifdef FOLLY_SANITIZE_THREAD #include <sanitizer/tsan_interface.h> #endif namespace folly { struct AsyncStackRoot; namespace fibers { class Baton; class FiberManager; struct TaskOptions { … }; /** * @class Fiber * @brief Fiber object used by FiberManager to execute tasks. * * Each Fiber object can be executing at most one task at a time. In active * phase it is running the task function and keeps its context. * Fiber is also used to pass data to blocked task and thus unblock it. * Each Fiber may be associated with a single FiberManager. */ class Fiber { … }; } // namespace fibers } // namespace folly #include <folly/fibers/Fiber-inl.h>