16 #ifndef BLOOMBERG_QUANTUM_YIELDING_THREAD_H 17 #define BLOOMBERG_QUANTUM_YIELDING_THREAD_H 21 #include <quantum/quantum_thread_traits.h> 32 template <
class DURATION>
40 if (time == DURATION(0)) {
42 std::this_thread::yield();
46 std::this_thread::sleep_for(time);
61 #endif //BLOOMBERG_QUANTUM_YIELDING_THREAD_H Definition: quantum_buffer_impl.h:22
static std::chrono::microseconds & yieldSleepIntervalUs()
Definition: quantum_thread_traits.h:42
static std::chrono::milliseconds & yieldSleepIntervalMs()
Dictates how long any thread should sleep on blocking calls when interacting with coroutines (e....
Definition: quantum_thread_traits.h:37
static DURATION defaultDuration()
Definition: quantum_yielding_thread.h:50
void operator()(DURATION time=defaultDuration())
Yields the current thread either via a busy wait loop or by sleeping it. Behavior is determined at co...
Definition: quantum_yielding_thread.h:38
This class provides the same functionality as a coroutine yield when called from a thread context.
Definition: quantum_yielding_thread.h:33