move python/NotificationQueueExecutor to futures/
authorJames Sedgwick <jsedgwick@fb.com>
Wed, 18 Oct 2017 03:21:36 +0000 (20:21 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 18 Oct 2017 03:43:13 +0000 (20:43 -0700)
Summary: as above

Reviewed By: yfeldblum

Differential Revision: D6076757

fbshipit-source-id: afe144129e8a0242ba6baee96a84a9084e6e2571

folly/Makefile.am
folly/executors/NotificationQueueExecutor.h [new file with mode: 0644]
folly/python/NotificationQueueExecutor.h [deleted file]
folly/python/executor.pxd

index ad956fb4177b6d2cf4522425dbd2f5dabc3e62fc..2e172ead582e3f22890f23a402ad9fc6e33b881c 100644 (file)
@@ -96,6 +96,7 @@ nobase_follyinclude_HEADERS = \
        executors/IOThreadPoolExecutor.h \
        executors/LifoSemMPMCQueue.h \
        executors/NamedThreadFactory.h \
+       executors/NotificationQueueExecutor.h \
        executors/PriorityLifoSemMPMCQueue.h \
        executors/PriorityThreadFactory.h \
        executors/SerialExecutor.h \
diff --git a/folly/executors/NotificationQueueExecutor.h b/folly/executors/NotificationQueueExecutor.h
new file mode 100644 (file)
index 0000000..3738be2
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2017-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/ExceptionString.h>
+#include <folly/Function.h>
+#include <folly/futures/DrivableExecutor.h>
+#include <folly/io/async/NotificationQueue.h>
+
+namespace folly {
+
+class NotificationQueueExecutor : public folly::DrivableExecutor {
+ public:
+  using Func = folly::Func;
+
+  void add(Func func) override {
+    queue_.putMessage(std::move(func));
+  }
+
+  int fileno() const {
+    return consumer_.getFd();
+  }
+
+  void drive() noexcept override {
+    Func func;
+    while (queue_.tryConsume(func)) {
+      try {
+        func();
+      } catch (const std::exception& ex) {
+        LOG(ERROR) << "Exception thrown by NotificationQueueExecutor task."
+                   << "Exception message: " << folly::exceptionStr(ex);
+      } catch (...) {
+        LOG(ERROR) << "Unknown Exception thrown "
+                   << "by NotificationQueueExecutor task.";
+      }
+    }
+  }
+
+ private:
+  folly::NotificationQueue<Func> queue_;
+  folly::NotificationQueue<Func>::SimpleConsumer consumer_{queue_};
+}; // NotificationQueueExecutor
+
+} // namespace folly
diff --git a/folly/python/NotificationQueueExecutor.h b/folly/python/NotificationQueueExecutor.h
deleted file mode 100644 (file)
index 7bd8f2a..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2017-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/ExceptionString.h>
-#include <folly/Function.h>
-#include <folly/futures/DrivableExecutor.h>
-#include <folly/io/async/NotificationQueue.h>
-
-namespace folly {
-namespace python {
-
-class NotificationQueueExecutor : public folly::DrivableExecutor {
- public:
-  using Func = folly::Func;
-
-  void add(Func func) override {
-    queue_.putMessage(std::move(func));
-  }
-
-  int fileno() const {
-    return consumer_.getFd();
-  }
-
-  void drive() noexcept override {
-    Func func;
-    while (queue_.tryConsume(func)) {
-      try {
-        func();
-      } catch (const std::exception& ex) {
-        LOG(ERROR) << "Exception thrown by NotificationQueueExecutor task."
-                   << "Exception message: " << folly::exceptionStr(ex);
-      } catch (...) {
-        LOG(ERROR) << "Unknown Exception thrown "
-                   << "by NotificationQueueExecutor task.";
-      }
-    }
-  }
-
- private:
-  folly::NotificationQueue<Func> queue_;
-  folly::NotificationQueue<Func>::SimpleConsumer consumer_{queue_};
-}; // NotificationQueueExecutor
-
-} // namespace python
-} // namespace folly
index ab4c51b7904a56a0aee374374cbc48fcfaab55c2..eeb8acd52c8b6e67882202256b6f1a53265f5c11 100644 (file)
@@ -1,8 +1,8 @@
 from libcpp.memory cimport unique_ptr
 from folly cimport cFollyExecutor
 
-cdef extern from "folly/python/NotificationQueueExecutor.h" namespace "folly::python":
-    cdef cppclass cNotificationQueueExecutor "folly::python::NotificationQueueExecutor"(cFollyExecutor):
+cdef extern from "folly/executors/NotificationQueueExecutor.h" namespace "folly":
+    cdef cppclass cNotificationQueueExecutor "folly::NotificationQueueExecutor"(cFollyExecutor):
         int fileno()
         void drive()