Summary:
this removes the dep EventBase has on wangle as we prepare to split off wangle
also changes namespace from folly::wangle to folly
Test Plan: just a couple of codemods so waiting for contbuild
Reviewed By: davejwatson@fb.com
Subscribers: trunkagent, fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, zeus-diffs@, nli, cold-storage-diffs@, unicorn-diffs@, targeting-diff-backend@, hannesr, vighnesh, fugalh, alandau, bmatheny, adityab, zhuohuang, luk, darshan, gunjan, hdoshi, dzhulgakov, alihussains, panin, ves, mshneer, folly-diffs@, lins, nimishshah
FB internal diff:
D1737376
Tasks:
5802833
Signature: t1:
1737376:
1418423430:
82d219c34fcc50218c380a17435e5880e53db6bd
--- /dev/null
+/*
+ * Copyright 2014 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 <functional>
+
+namespace folly {
+
+typedef std::function<void()> Func;
+
+/// An Executor accepts units of work with add(), which should be
+/// threadsafe.
+class Executor {
+ public:
+ virtual ~Executor() = default;
+
+ /// Enqueue a function to executed by this executor. This and all
+ /// variants must be threadsafe.
+ virtual void add(Func) = 0;
+
+ /// A convenience function for shared_ptr to legacy functors.
+ ///
+ /// Sometimes you have a functor that is move-only, and therefore can't be
+ /// converted to a std::function (e.g. std::packaged_task). In that case,
+ /// wrap it in a shared_ptr (or maybe folly::MoveWrapper) and use this.
+ template <class P>
+ void addPtr(P fn) {
+ this->add([fn]() mutable { (*fn)(); });
+ }
+};
+
+} // folly
dynamic-inl.h \
Exception.h \
ExceptionWrapper.h \
+ Executor.h \
EvictingCacheMap.h \
experimental/Bits.h \
experimental/EliasFanoCoding.h \
Varint.h \
VersionCheck.h \
wangle/Deprecated.h \
- wangle/Executor.h \
wangle/Future-inl.h \
wangle/Future.h \
wangle/InlineExecutor.h \
std::make_shared<folly::wangle::NamedThreadFactory>("BootstrapWorker"))
, acceptorFactory_(acceptorFactory)
{}
- virtual std::thread newThread(folly::wangle::Func&& func) override;
+ virtual std::thread newThread(folly::Func&& func) override;
void setInternalFactory(
std::shared_ptr<folly::wangle::NamedThreadFactory> internalFactory);
namespace folly {
std::thread ServerWorkerFactory::newThread(
- folly::wangle::Func&& func) {
+ folly::Func&& func) {
auto id = nextWorkerId_++;
auto worker = acceptorFactory_->newAcceptor();
{
*/
#pragma once
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
#include <thread>
*/
#pragma once
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
#include <folly/experimental/wangle/concurrent/LifoSemMPMCQueue.h>
#include <folly/experimental/wangle/concurrent/NamedThreadFactory.h>
#include <folly/experimental/wangle/rx/Observable.h>
using namespace folly::wangle;
using namespace std::chrono;
-static Func burnMs(uint64_t ms) {
+static folly::Func burnMs(uint64_t ms) {
return [ms]() { std::this_thread::sleep_for(milliseconds(ms)); };
}
#include <folly/SmallLocks.h>
#include <folly/ThreadLocal.h>
#include <folly/small_vector.h>
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
#include <map>
#include <memory>
#pragma once
#include <folly/ExceptionWrapper.h>
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
namespace folly { namespace wangle {
typedef folly::exception_wrapper Error;
- // The wangle::Executor is basically an rx Scheduler (by design). So just
+ // The Executor is basically an rx Scheduler (by design). So just
// alias it.
- typedef std::shared_ptr<folly::wangle::Executor> SchedulerPtr;
+ typedef std::shared_ptr<folly::Executor> SchedulerPtr;
template <class T, size_t InlineObservers = 3> struct Observable;
template <class T> struct Observer;
#include <folly/io/async/AsyncTimeout.h>
#include <folly/io/async/TimeoutManager.h>
#include <folly/io/async/Request.h>
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
#include <memory>
#include <stack>
#include <list>
* another thread it is explicitly listed in the method comments.
*/
class EventBase :
- private boost::noncopyable, public TimeoutManager, public wangle::Executor
+ private boost::noncopyable, public TimeoutManager, public Executor
{
public:
/**
*/
const std::string& getName();
- /// Implements the wangle::Executor interface
+ /// Implements the Executor interface
void add(Cob fn) override {
// runInEventBaseThread() takes a const&,
// so no point in doing std::move here.
+++ /dev/null
-/*
- * Copyright 2014 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 <functional>
-
-namespace folly { namespace wangle {
-
-typedef std::function<void()> Func;
-
-/// An Executor accepts units of work with add(), which should be
-/// threadsafe.
-class Executor {
- public:
- virtual ~Executor() = default;
-
- /// Enqueue a function to executed by this executor. This and all
- /// variants must be threadsafe.
- virtual void add(Func) = 0;
-
- /// A convenience function for shared_ptr to legacy functors.
- ///
- /// Sometimes you have a functor that is move-only, and therefore can't be
- /// converted to a std::function (e.g. std::packaged_task). In that case,
- /// wrap it in a shared_ptr (or maybe folly::MoveWrapper) and use this.
- template <class P>
- void addPtr(P fn) {
- this->add([fn]() mutable { (*fn)(); });
- }
-};
-
-}} // folly::wangle
*/
#pragma once
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
namespace folly { namespace wangle {
#pragma once
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
namespace folly { namespace wangle {
#pragma once
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
#include <chrono>
#include <memory>
#include <stdexcept>
#include <folly/wangle/Try.h>
#include <folly/wangle/Promise.h>
#include <folly/wangle/Future.h>
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
#include <folly/wangle/detail/FSM.h>
#include <folly/io/async/Request.h>
#include <type_traits>
#include <unistd.h>
#include <folly/Memory.h>
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
#include <folly/wangle/Future.h>
#include <folly/wangle/ManualExecutor.h>
#include <folly/MPMCQueue.h>
TEST(Future, thenVariants) {
SomeClass anObject;
- Executor* anExecutor;
+ folly::Executor* anExecutor;
{Future<B> f = someFuture<A>().then(&aFunction<Future<B>, Try<A>&&>);}
{Future<B> f = someFuture<A>().then(&SomeClass::aStaticMethod<Future<B>, Try<A>&&>);}
#include <gtest/gtest.h>
#include <memory>
#include <folly/wangle/Future.h>
-#include <folly/wangle/Executor.h>
+#include <folly/Executor.h>
using namespace folly::wangle;
using namespace std;
TEST(Future, thenVariants) {
SomeClass anObject;
- Executor* anExecutor;
+ folly::Executor* anExecutor;
#{tests.join("\n ")}
}