Commit ad001a22 authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Deprecate futures::sleepUnsafe

Summary: Deprecate sleepUnsafe to avoid use growing and to clearly communicate the change.

Reviewed By: yfeldblum

Differential Revision: D14255404

fbshipit-source-id: cb2116910a15b9835fef9bf4273242457a5e96bd
parent a703ff28
...@@ -46,7 +46,11 @@ namespace futures { ...@@ -46,7 +46,11 @@ namespace futures {
/// needed. If your program never uses any timeouts or other time-based /// needed. If your program never uses any timeouts or other time-based
/// Futures you will pay no Timekeeper thread overhead. /// Futures you will pay no Timekeeper thread overhead.
SemiFuture<Unit> sleep(Duration, Timekeeper* = nullptr); SemiFuture<Unit> sleep(Duration, Timekeeper* = nullptr);
Future<Unit> sleepUnsafe(Duration, Timekeeper* = nullptr); [[deprecated(
"futures::sleep now returns a SemiFuture<Unit>. "
"sleepUnsafe is deprecated. "
"Please call futures::sleep and apply an executor with .via")]] Future<Unit>
sleepUnsafe(Duration, Timekeeper* = nullptr);
/** /**
* Set func as the callback for each input Future and return a vector of * Set func as the callback for each input Future and return a vector of
......
...@@ -79,11 +79,14 @@ TEST(Timekeeper, futureSleep) { ...@@ -79,11 +79,14 @@ TEST(Timekeeper, futureSleep) {
EXPECT_GE(now() - t1, one_ms); EXPECT_GE(now() - t1, one_ms);
} }
FOLLY_PUSH_WARNING
FOLLY_GNU_DISABLE_WARNING("-Wdeprecated-declarations")
TEST(Timekeeper, futureSleepUnsafe) { TEST(Timekeeper, futureSleepUnsafe) {
auto t1 = now(); auto t1 = now();
futures::sleepUnsafe(one_ms).get(); futures::sleepUnsafe(one_ms).get();
EXPECT_GE(now() - t1, one_ms); EXPECT_GE(now() - t1, one_ms);
} }
FOLLY_POP_WARNING
TEST(Timekeeper, futureSleepHandlesNullTimekeeperSingleton) { TEST(Timekeeper, futureSleepHandlesNullTimekeeperSingleton) {
Singleton<ThreadWheelTimekeeper>::make_mock([] { return nullptr; }); Singleton<ThreadWheelTimekeeper>::make_mock([] { return nullptr; });
......
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