executors/BlockingQueue.h \
executors/CPUThreadPoolExecutor.h \
executors/Codel.h \
+ executors/DrivableExecutor.h \
executors/FiberIOExecutor.h \
executors/FutureExecutor.h \
executors/GlobalExecutor.h \
Format-inl.h \
functional/Invoke.h \
futures/Barrier.h \
- futures/DrivableExecutor.h \
futures/Future-pre.h \
futures/helpers.h \
futures/Future.h \
--- /dev/null
+/*
+ * Copyright 2017 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 {
+
+/*
+ * A DrivableExecutor can be driven via its drive() method
+ * Examples include EventBase (via loopOnce()) and ManualExecutor
+ * (via makeProgress()).
+ *
+ * This interface is most handy in conjunction with
+ * Future<T>::getVia(DrivableExecutor*) and
+ * Future<T>::waitVia(DrivableExecutor*)
+ *
+ * These call drive() * repeatedly until the Future is fulfilled.
+ * getVia() returns the value (or throws the exception) and waitVia() returns
+ * the same Future for chainability.
+ *
+ * These will be most helpful in tests, for instance if you need to pump a mock
+ * EventBase until Futures complete.
+ */
+
+class DrivableExecutor : public virtual Executor {
+ public:
+ ~DrivableExecutor() override = default;
+
+ // Make progress on this Executor's work.
+ //
+ // Drive *must not* busy wait if there is no work to do. Instead,
+ // sleep (using a semaphore or similar) until at least one event is
+ // processed.
+ // I.e. make_future().via(foo).then(...).getVia(DrivableExecutor)
+ // must not spin, even though nothing happens on the drivable
+ // executor.
+ virtual void drive() = 0;
+};
+
+} // namespace folly
#include <folly/ExceptionString.h>
#include <folly/Function.h>
-#include <folly/futures/DrivableExecutor.h>
+#include <folly/executors/DrivableExecutor.h>
#include <folly/io/async/NotificationQueue.h>
namespace folly {
+++ /dev/null
-/*
- * Copyright 2017 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 {
-
-/*
- * A DrivableExecutor can be driven via its drive() method
- * Examples include EventBase (via loopOnce()) and ManualExecutor
- * (via makeProgress()).
- *
- * This interface is most handy in conjunction with
- * Future<T>::getVia(DrivableExecutor*) and
- * Future<T>::waitVia(DrivableExecutor*)
- *
- * These call drive() * repeatedly until the Future is fulfilled.
- * getVia() returns the value (or throws the exception) and waitVia() returns
- * the same Future for chainability.
- *
- * These will be most helpful in tests, for instance if you need to pump a mock
- * EventBase until Futures complete.
- */
-
-class DrivableExecutor : public virtual Executor {
- public:
- ~DrivableExecutor() override = default;
-
- // Make progress on this Executor's work.
- //
- // Drive *must not* busy wait if there is no work to do. Instead,
- // sleep (using a semaphore or similar) until at least one event is
- // processed.
- // I.e. make_future().via(foo).then(...).getVia(DrivableExecutor)
- // must not spin, even though nothing happens on the drivable
- // executor.
- virtual void drive() = 0;
-};
-
-} // namespace folly
#include <folly/Portability.h>
#include <folly/Try.h>
#include <folly/Utility.h>
-#include <folly/futures/DrivableExecutor.h>
+#include <folly/executors/DrivableExecutor.h>
#include <folly/futures/FutureException.h>
#include <folly/futures/Promise.h>
#include <folly/futures/detail/Types.h>
#include <queue>
#include <folly/LifoSem.h>
-#include <folly/futures/DrivableExecutor.h>
+#include <folly/executors/DrivableExecutor.h>
#include <folly/futures/ScheduledExecutor.h>
namespace folly {
<h3 id="getvia-and-waitvia">getVia() and waitVia() <a href="#getvia-and-waitvia" class="headerLink">#</a></h3>
-<p><tt>T Future<T>::getVia(DrivableExecutor*)</tt> and <tt>Future<T> Future<T>::waitVia(DrivableExecutor*)</tt> have the same semantics as <tt>get()</tt> and <tt>wait()</tt> except that they drive some Executor until the Future is complete. <a href="https://github.com/facebook/folly/blob/master/folly/futures/DrivableExecutor.h" target="_blank"><tt>DrivableExecutor</tt></a> is a simple subinterface of <tt>Executor</tt> that requires the presence of a method <tt>drive()</tt> which can somehow make progress on the Executor's work. Two commonly helpful implementations are <a href="https://github.com/facebook/folly/blob/master/folly/io/async/EventBase.h" target="_blank"><tt>EventBase</tt></a> (where <tt>drive()</tt> loops on the EventBase) and <a href="https://github.com/facebook/folly/blob/master/folly/futures/ManualExecutor.h" target="_blank"><tt>ManualExecutor</tt></a>. These are simple but useful sugar for the following common pattern:</p>
+<p><tt>T Future<T>::getVia(DrivableExecutor*)</tt> and <tt>Future<T> Future<T>::waitVia(DrivableExecutor*)</tt> have the same semantics as <tt>get()</tt> and <tt>wait()</tt> except that they drive some Executor until the Future is complete. <a href="https://github.com/facebook/folly/blob/master/folly/executors/DrivableExecutor.h" target="_blank"><tt>DrivableExecutor</tt></a> is a simple subinterface of <tt>Executor</tt> that requires the presence of a method <tt>drive()</tt> which can somehow make progress on the Executor's work. Two commonly helpful implementations are <a href="https://github.com/facebook/folly/blob/master/folly/io/async/EventBase.h" target="_blank"><tt>EventBase</tt></a> (where <tt>drive()</tt> loops on the EventBase) and <a href="https://github.com/facebook/folly/blob/master/folly/futures/ManualExecutor.h" target="_blank"><tt>ManualExecutor</tt></a>. These are simple but useful sugar for the following common pattern:</p>
<p>Given this:</p>
#include <folly/Baton.h>
#include <folly/MPMCQueue.h>
-#include <folly/futures/DrivableExecutor.h>
+#include <folly/executors/DrivableExecutor.h>
#include <folly/futures/Future.h>
#include <folly/futures/InlineExecutor.h>
#include <folly/futures/ManualExecutor.h>
#include <folly/Function.h>
#include <folly/Portability.h>
#include <folly/ScopeGuard.h>
+#include <folly/executors/DrivableExecutor.h>
#include <folly/experimental/ExecutionObserver.h>
-#include <folly/futures/DrivableExecutor.h>
#include <folly/io/async/AsyncTimeout.h>
#include <folly/io/async/HHWheelTimer.h>
#include <folly/io/async/Request.h>
#include <folly/io/async/TimeoutManager.h>
#include <folly/portability/Event.h>
-
namespace folly {
using Cob = Func; // defined in folly/Executor.h