Commit 9f6ec59f authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook Github Bot

SequencedExecutor

Reviewed By: phoad

Differential Revision: D7220254

fbshipit-source-id: 3a2a49fd17d0aca4acc590c1c16db75ace472216
parent 88b3fb8e
......@@ -23,6 +23,7 @@
#include <folly/executors/DrivableExecutor.h>
#include <folly/executors/ScheduledExecutor.h>
#include <folly/executors/SequencedExecutor.h>
#include <folly/synchronization/LifoSem.h>
namespace folly {
......@@ -35,7 +36,8 @@ namespace folly {
/// NB No attempt has been made to make anything other than add and schedule
/// threadsafe.
class ManualExecutor : public DrivableExecutor,
public ScheduledExecutor {
public ScheduledExecutor,
public SequencedExecutor {
public:
void add(Func) override;
......
......@@ -18,11 +18,13 @@
#include <folly/ExceptionString.h>
#include <folly/Function.h>
#include <folly/executors/DrivableExecutor.h>
#include <folly/executors/SequencedExecutor.h>
#include <folly/io/async/NotificationQueue.h>
namespace folly {
class NotificationQueueExecutor : public folly::DrivableExecutor {
class NotificationQueueExecutor : public DrivableExecutor,
public SequencedExecutor {
public:
using Func = folly::Func;
......
/*
* Copyright 2018-present Facebook, Inc.
*
* 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>
namespace folly {
// An SequencedExecutor is an executor that provides the following guarantee:
// if add(A) and add(B) were sequenced then execution of A and B will be
// sequenced too.
class SequencedExecutor : public virtual Executor {
public:
~SequencedExecutor() override = default;
};
} // namespace folly
......@@ -18,8 +18,8 @@
#include <memory>
#include <folly/Executor.h>
#include <folly/executors/GlobalExecutor.h>
#include <folly/executors/SequencedExecutor.h>
namespace folly {
......@@ -46,7 +46,7 @@ namespace folly {
* parent executor is executing tasks.
*/
class SerialExecutor : public folly::Executor {
class SerialExecutor : public SequencedExecutor {
public:
~SerialExecutor() override = default;
SerialExecutor(SerialExecutor const&) = delete;
......
......@@ -39,6 +39,7 @@
#include <folly/Portability.h>
#include <folly/ScopeGuard.h>
#include <folly/executors/DrivableExecutor.h>
#include <folly/executors/SequencedExecutor.h>
#include <folly/experimental/ExecutionObserver.h>
#include <folly/io/async/AsyncTimeout.h>
#include <folly/io/async/HHWheelTimer.h>
......@@ -126,7 +127,8 @@ class VirtualEventBase;
*/
class EventBase : private boost::noncopyable,
public TimeoutManager,
public DrivableExecutor {
public DrivableExecutor,
public SequencedExecutor {
public:
using Func = folly::Function<void()>;
......
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