proxygen
EventBaseLoopController.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
21 #include <atomic>
22 #include <memory>
23 
24 namespace folly {
25 namespace fibers {
26 
28  public:
29  explicit EventBaseLoopController();
30  ~EventBaseLoopController() override;
31 
35  void attachEventBase(EventBase& eventBase);
36  void attachEventBase(VirtualEventBase& eventBase);
37 
39  return eventBase_;
40  }
41 
42  void setLoopRunner(InlineFunctionRunner* loopRunner) {
43  loopRunner_ = loopRunner;
44  }
45 
46  private:
48  public:
50  : controller_(controller) {}
51 
52  void runLoopCallback() noexcept override {
54  }
55 
56  private:
58  };
59 
60  bool awaitingScheduling_{false};
64  FiberManager* fm_{nullptr};
65  std::atomic<bool> eventBaseAttached_{false};
67 
68  /* LoopController interface */
69 
70  void setFiberManager(FiberManager* fm) override;
71  void schedule() override;
72  void runLoop() override;
73  void scheduleThreadSafe() override;
74  void timedSchedule(std::function<void()> func, TimePoint time) override;
75 
76  friend class FiberManager;
77 };
78 } // namespace fibers
79 } // namespace folly
80 
void timedSchedule(std::function< void()> func, TimePoint time) override
void setLoopRunner(InlineFunctionRunner *loopRunner)
Executor::KeepAlive< VirtualEventBase > eventBaseKeepAlive_
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
requires E e noexcept(noexcept(s.error(std::move(e))))
std::chrono::time_point< Clock > TimePoint
Single-threaded task execution engine.
void setFiberManager(FiberManager *fm) override
std::chrono::nanoseconds time()