Summary:
[Folly] Use `MemoryIdler` in `SaturatingSemaphore`.
As is used in `Baton`.
And merge the two invocations of `futexWait` and `futexWaitUntil` - `futexWaitUntil` also tests for the max-deadline internally.
Reviewed By: djwatson
Differential Revision:
D6720045
fbshipit-source-id:
a48187a6c866dbf99bb5c7283e0288b939bef2e5
#include <folly/Likely.h>
#include <folly/detail/Futex.h>
+#include <folly/detail/MemoryIdler.h>
#include <folly/portability/Asm.h>
#include <folly/synchronization/WaitOptions.h>
continue;
}
}
- if (deadline == std::chrono::time_point<Clock, Duration>::max()) {
- state_.futexWait(BLOCKED);
- } else {
- state_.futexWaitUntil(BLOCKED, deadline);
- }
+ detail::MemoryIdler::futexWaitUntil(state_, BLOCKED, deadline);
}
}
asm_volatile_pause();