Commit c93226d1 authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook Github Bot 1

Resolve fibers-futures dependency

Reviewed By: mzlee

Differential Revision: D3780312

fbshipit-source-id: c42c8f0a06b82520ee1b46f105a2a85ad524c442
parent 2dedc14b
......@@ -514,6 +514,8 @@ nobase_follyinclude_HEADERS += \
fibers/Fiber-inl.h \
fibers/FiberManager.h \
fibers/FiberManager-inl.h \
fibers/FiberManagerInternal.h \
fibers/FiberManagerInternal-inl.h \
fibers/FiberManagerMap.h \
fibers/ForEach.h \
fibers/ForEach-inl.h \
......
......@@ -19,7 +19,7 @@
#include <vector>
#include <folly/Optional.h>
#include <folly/fibers/FiberManager.h>
#include <folly/fibers/FiberManagerInternal.h>
#include <folly/fibers/Promise.h>
#include <folly/Try.h>
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
#include <folly/fibers/Fiber.h>
#include <folly/fibers/FiberManager.h>
#include <folly/fibers/FiberManagerInternal.h>
namespace folly {
namespace fibers {
......
......@@ -18,7 +18,7 @@
#include <chrono>
#include <folly/detail/MemoryIdler.h>
#include <folly/fibers/FiberManager.h>
#include <folly/fibers/FiberManagerInternal.h>
#include <folly/portability/Asm.h>
namespace folly {
......
......@@ -15,7 +15,7 @@
*/
#pragma once
#include <folly/fibers/FiberManager.h>
#include <folly/fibers/FiberManagerInternal.h>
#include <folly/fibers/LoopController.h>
#include <folly/io/async/EventBase.h>
#include <atomic>
......
......@@ -23,7 +23,7 @@
#include <folly/Likely.h>
#include <folly/Portability.h>
#include <folly/fibers/BoostContextCompatibility.h>
#include <folly/fibers/FiberManager.h>
#include <folly/fibers/FiberManagerInternal.h>
#include <folly/portability/SysSyscall.h>
#include <folly/portability/Unistd.h>
......
This diff is collapsed.
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "FiberManager.h"
#include "FiberManagerInternal.h"
#include <signal.h>
......
This diff is collapsed.
/*
* Copyright 2016 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/futures/Promise.h>
namespace folly {
namespace fibers {
template <typename F>
auto FiberManager::addTaskFuture(F&& func) -> folly::Future<
typename folly::Unit::Lift<typename std::result_of<F()>::type>::type> {
using T = typename std::result_of<F()>::type;
using FutureT = typename folly::Unit::Lift<T>::type;
folly::Promise<FutureT> p;
auto f = p.getFuture();
addTaskFinally(
[func = std::forward<F>(func)]() mutable { return func(); },
[p = std::move(p)](folly::Try<T> && t) mutable {
p.setTry(std::move(t));
});
return f;
}
template <typename F>
auto FiberManager::addTaskRemoteFuture(F&& func) -> folly::Future<
typename folly::Unit::Lift<typename std::result_of<F()>::type>::type> {
folly::Promise<
typename folly::Unit::Lift<typename std::result_of<F()>::type>::type>
p;
auto f = p.getFuture();
addTaskRemote(
[ p = std::move(p), func = std::forward<F>(func), this ]() mutable {
auto t = folly::makeTryWith(std::forward<F>(func));
runInMainContext([&]() { p.setTry(std::move(t)); });
});
return f;
}
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -16,7 +16,7 @@
#pragma once
#include <folly/fibers/EventBaseLoopController.h>
#include <folly/fibers/FiberManager.h>
#include <folly/fibers/FiberManagerInternal.h>
namespace folly {
namespace fibers {
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <folly/fibers/FiberManager.h>
#include <folly/fibers/FiberManagerInternal.h>
namespace folly {
namespace fibers {
......
......@@ -15,7 +15,7 @@
*/
#include <folly/Optional.h>
#include <folly/fibers/FiberManager.h>
#include <folly/fibers/FiberManagerInternal.h>
#include <folly/fibers/ForEach.h>
namespace folly {
......
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