Convert a polling loop to a futex wait
Summary:Add a new method to MPMCQueue: ``` template <class Clock, typename... Args> bool tryWriteUntil(const std::chrono::time_point<Clock>& when, Args&&... args) noexcept ``` This allows you to write producers which terminate reliably in the absence of consumers. Returns `true` if `args` was enqueued, `false` otherwise. `Clock` must be one of the types supported by the underlying call to `folly::detail::Futex::futexWaitUntil`; at time of writing these are `std::chrono::steady_clock` and `std::chrono::system_clock`. Reviewed By: nbronson Differential Revision: D2895574 fb-gh-sync-id: bdfabcd043191c149f1271e30ffc28476cc8a36e shipit-source-id: bdfabcd043191c149f1271e30ffc28476cc8a36e
Showing
This diff is collapsed.
Please register or sign in to comment