From 70fb1baffe801ba9c3a2108d289e7468d5d463f5 Mon Sep 17 00:00:00 2001 From: Hans Fugal Date: Fri, 21 Feb 2014 10:15:31 -0800 Subject: [PATCH] (wangle) remove Future::wait 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 | 13 ------------- folly/wangle/test/FutureTest.cpp | 15 --------------- 2 files changed, 28 deletions(-) diff --git a/folly/wangle/Future.h b/folly/wangle/Future.h index 48e8822e..354a0bae 100644 --- a/folly/wangle/Future.h +++ b/folly/wangle/Future.h @@ -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& valueTry(); /** When this Future has completed, execute func which is a function that diff --git a/folly/wangle/test/FutureTest.cpp b/folly/wangle/test/FutureTest.cpp index cdc8f82d..24a318f2 100644 --- a/folly/wangle/test/FutureTest.cpp +++ b/folly/wangle/test/FutureTest.cpp @@ -500,21 +500,6 @@ TEST(when, small_vector) { } } -TEST(Future, wait) { - Promise 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 pb; Promise pi; -- 2.34.1