proxygen
LoopController.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 
18 #include <chrono>
19 #include <functional>
20 
21 namespace folly {
22 namespace fibers {
23 
24 class FiberManager;
25 
27  public:
28  typedef std::chrono::steady_clock Clock;
29  typedef std::chrono::time_point<Clock> TimePoint;
30 
31  virtual ~LoopController() {}
32 
36  virtual void setFiberManager(FiberManager*) = 0;
37 
42  virtual void schedule() = 0;
43 
48  virtual void runLoop() = 0;
49 
53  virtual void scheduleThreadSafe() = 0;
54 
58  virtual void timedSchedule(std::function<void()> func, TimePoint time) = 0;
59 };
60 } // namespace fibers
61 } // namespace folly
virtual void scheduleThreadSafe()=0
virtual void setFiberManager(FiberManager *)=0
virtual void timedSchedule(std::function< void()> func, TimePoint time)=0
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
std::chrono::time_point< Clock > TimePoint
Single-threaded task execution engine.
std::chrono::steady_clock Clock
std::chrono::nanoseconds time()