(wangle) remove Future::wait
authorHans Fugal <fugalh@fb.com>
Fri, 21 Feb 2014 18:15:31 +0000 (10:15 -0800)
committerDave Watson <davejwatson@fb.com>
Fri, 28 Feb 2014 22:03:02 +0000 (14:03 -0800)
Summary: pulling the trigger

Test Plan: Unit tests. Wait for contbuild and dependent unit tests

Reviewed By: hannesr@fb.com

FB internal diff: D1184842

folly/wangle/Future.h
folly/wangle/test/FutureTest.cpp

index 48e8822e57f49307db3e3d069b97e3e1e3da01e1..354a0bae953ad69d15fea381dd149f24f4cd3f76 100644 (file)
@@ -79,19 +79,6 @@ class Future {
       when this returns true. */
   bool isReady() const;
 
-  /** Wait until the result (or exception) is ready. Once this returns,
-    value() will not block, and isReady() will return true.
-
-    XXX This implementation is simplistic and inefficient, but it does work
-    and a fully intelligent implementation is coming down the pipe.
-  */
-  void wait() const {
-    while (!isReady()) {
-      // spin
-      std::this_thread::yield();
-    }
-  }
-
   Try<T>& valueTry();
 
   /** When this Future has completed, execute func which is a function that
index cdc8f82d7b659265875dcd22967e5eb82c3782d3..24a318f2357aabd0c284d15982de085ea057064a 100644 (file)
@@ -500,21 +500,6 @@ TEST(when, small_vector) {
   }
 }
 
-TEST(Future, wait) {
-  Promise<void> p;
-  auto f = p.getFuture();
-  auto t = std::thread([&] {
-    std::this_thread::sleep_for(std::chrono::microseconds(10));
-    p.setValue();
-  });
-
-  f.wait();
-
-  EXPECT_TRUE(f.isReady());
-
-  t.join();
-}
-
 TEST(Future, whenAllVariadic) {
   Promise<bool> pb;
   Promise<int> pi;