From: Hans Fugal Date: Fri, 21 Feb 2014 18:15:31 +0000 (-0800) Subject: (wangle) remove Future::wait X-Git-Tag: v0.22.0~673 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=70fb1baffe801ba9c3a2108d289e7468d5d463f5;p=folly.git (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 --- 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;