Delete folly/futures/OpaqueCallbackShunt.h
authorChristopher Dykes <cdykes@fb.com>
Tue, 20 Jun 2017 17:11:42 +0000 (10:11 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 20 Jun 2017 17:21:58 +0000 (10:21 -0700)
Summary: It is not used anywhere, not even in tests, so kill it.

Reviewed By: yfeldblum

Differential Revision: D5280800

fbshipit-source-id: 7e6a308bf09198548b77dcc1bfacc0ee95eb4887

folly/Makefile.am
folly/futures/OpaqueCallbackShunt.h [deleted file]

index 37d47db443cd2c76385481e75fce38643c7aaf90..e02841a466ce9ce248d64e8ab4b40ea374282b4c 100644 (file)
@@ -195,7 +195,6 @@ nobase_follyinclude_HEADERS = \
        futures/FutureSplitter.h \
        futures/InlineExecutor.h \
        futures/ManualExecutor.h \
-       futures/OpaqueCallbackShunt.h \
        futures/Promise-inl.h \
        futures/Promise.h \
        futures/QueuedImmediateExecutor.h \
diff --git a/folly/futures/OpaqueCallbackShunt.h b/folly/futures/OpaqueCallbackShunt.h
deleted file mode 100644 (file)
index 81fa04f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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/futures/Promise.h>
-
-namespace folly {
-
-/// These classes help you wrap an existing C style callback function
-/// into a Future.
-///
-///   void legacy_send_async(..., void (*cb)(void*), void*);
-///
-///   Future<T> wrappedSendAsync(T&& obj) {
-///     auto handle = new OpaqueCallbackShunt<T>(obj);
-///     auto future = handle->promise_.getFuture();
-///     legacy_send_async(..., OpaqueCallbackShunt<T>::callback, handle)
-///     return future;
-///   }
-///
-/// If the legacy function doesn't conform to void (*cb)(void*), use a lambda:
-///
-///   auto cb = [](t1*, t2*, void* arg) {
-///     OpaqueCallbackShunt<T>::callback(arg);
-///   };
-///   legacy_send_async(..., cb, handle);
-
-template <typename T>
-class OpaqueCallbackShunt {
-public:
-  explicit OpaqueCallbackShunt(T&& obj)
-    : obj_(std::move(obj)) { }
-  static void callback(void* arg) {
-    std::unique_ptr<OpaqueCallbackShunt<T>> handle(
-      static_cast<OpaqueCallbackShunt<T>*>(arg));
-    handle->promise_.setValue(std::move(handle->obj_));
-  }
-  folly::Promise<T> promise_;
-private:
-  T obj_;
-};
-
-} // folly