An Unbiased View of sleep
No synchronization is executed on *this alone. Concurrently calling be a part of() on exactly the same thread item from many threads constitutes an information race that leads to undefined behavior.
atomic_compare_exchange_weakatomic_compare_exchange_weak_explicitatomic_compare_exchange_strongatomic_compare_exchange_strong_explicit
This overload can be employed to ignore spurious awakenings though expecting a particular condition to be correct.
The highest-level purpose might connect its return worth or an exception to your caller by way of std::assure or by modifying shared variables (which may have to have synchronization, see std::mutex and std::atomic).
three) Registers *this with the duration of the connect with, for being notified if a halt request is created on stoken's affiliated stop-condition; it can be then comparable to
The call to std::async synchronizes with the decision to file, as well as completion of file is sequenced before you make the shared state Prepared.
The normal suggests that the clock tied to abs_time be used to measure time; that clock just isn't necessary to certainly be a monotonic clock. There isn't any assures regarding the behavior of the functionality Should the clock is altered discontinuously, but the present implementations transform abs_time from Clock to std::chrono::system_clock and delegate to POSIX pthread_cond_timedwait so which the hold out honors changes into the procedure clock, although not for the consumer-presented Clock.
The standard endorses that a gradual clock is accustomed to measure the length. If an implementation makes use of a method clock rather, the wait time may also be delicate to clock changes.
The operate also might block until just after sleep_time has actually been attained because of process scheduling or useful resource competition delays.
atomic_compare_exchange_weakatomic_compare_exchange_weak_explicitatomic_compare_exchange_strongatomic_compare_exchange_strong_explicit
The category thread represents one thread of execution. Threads permit various features to execute concurrently.
atomic_compare_exchange_weakatomic_compare_exchange_weak_explicitatomic_compare_exchange_strongatomic_compare_exchange_strong_explicit
Blocks the execution of the current thread for at least until eventually the TIME_UTC based length pointed to by period has elapsed.
This permits the functionality to examine if quit has become asked for all through its execution, and return if it has.
In the event the std::foreseeable future attained from std::async is not moved from or bound to a reference, the destructor in the std::long run will block at the conclusion of the full expression till the asynchronous operation completes, in essence building code which include the Stages of sleep following synchronous: