add waitWithSemaphore to folly::wangle
authorMatt Dordal <mnd@fb.com>
Tue, 13 May 2014 17:37:45 +0000 (10:37 -0700)
committerDave Watson <davejwatson@fb.com>
Tue, 20 May 2014 19:53:59 +0000 (12:53 -0700)
commitdb37af8437399c0578a30e5bf553f9fe231b5c82
tree13401dd1211e7a3ab58f1b57b4009034574eca95
parentd7bda3ad6381aaf33c8cac584654b35eceb1301c
add waitWithSemaphore to folly::wangle

Summary:
It may be useful to wait for a future to finish. This adds a utility function
to do so, returning a completed future.

NB: While it doesn't matter which thread executes the `then`, there does need
to be two threads. If not, this will deadlock forever. I'm not sure if there's
a way to detect/prevent that.

Test Plan: added some unit tests.

Reviewed By: hans@fb.com

FB internal diff: D1319330
folly/wangle/Future-inl.h
folly/wangle/Future.h
folly/wangle/test/FutureTest.cpp