Commit 70fb1baf authored by Hans Fugal's avatar Hans Fugal Committed by Dave Watson

(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
parent 53bcd888
......@@ -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
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment