Commit e50c78af authored by Spencer Baumgardner's avatar Spencer Baumgardner Committed by Facebook Github Bot

add common interface for loop controllers with publicly accessible executor

Summary: add common interface for loop controllers with publicly accessible executor

Reviewed By: A5he

Differential Revision: D19626108

fbshipit-source-id: 07884726d7fce273dd56bdcf454be70051a4f62b
parent 97c2cdd4
......@@ -16,8 +16,8 @@
#pragma once
#include <folly/fibers/ExecutorBasedLoopController.h>
#include <folly/fibers/FiberManagerInternal.h>
#include <folly/fibers/LoopController.h>
#include <folly/io/async/VirtualEventBase.h>
#include <atomic>
#include <memory>
......@@ -25,7 +25,7 @@
namespace folly {
namespace fibers {
class EventBaseLoopController : public LoopController {
class EventBaseLoopController : public ExecutorBasedLoopController {
public:
explicit EventBaseLoopController();
~EventBaseLoopController() override;
......@@ -44,6 +44,10 @@ class EventBaseLoopController : public LoopController {
loopRunner_ = loopRunner;
}
folly::Executor* executor() const override {
return eventBase_;
}
private:
class ControllerCallback : public folly::EventBase::LoopCallback {
public:
......
/*
* Copyright (c) Facebook, Inc. and its 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 <folly/Executor.h>
#include <folly/fibers/LoopController.h>
namespace folly {
namespace fibers {
/**
* Interface for LoopController with publicly acessible executor
*/
class ExecutorBasedLoopController : public fibers::LoopController {
public:
virtual folly::Executor* executor() const = 0;
};
} // namespace fibers
} // namespace folly
......@@ -19,8 +19,8 @@
#include <memory>
#include <folly/Executor.h>
#include <folly/fibers/ExecutorBasedLoopController.h>
#include <folly/fibers/FiberManagerInternal.h>
#include <folly/fibers/LoopController.h>
namespace folly {
namespace fibers {
......@@ -72,12 +72,12 @@ class ExecutorTimeoutManager : public TimeoutManager {
/**
* A fiber loop controller that works for arbitrary folly::Executor
*/
class ExecutorLoopController : public fibers::LoopController {
class ExecutorLoopController : public fibers::ExecutorBasedLoopController {
public:
explicit ExecutorLoopController(folly::Executor* executor);
~ExecutorLoopController() override;
folly::Executor* executor() const {
folly::Executor* executor() const override {
return executor_;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment