Struct Spinlock::Sleeper¶
Defined in File spinlock.hpp
Nested Relationships¶
This struct is a nested type of Struct Spinlock.
Struct Documentation¶
-
struct
wrench::Spinlock
::
Sleeper
¶ A struct which can be used to spin for a certain number of iterations and then sleep if the iteration count has been reached.
Public Functions
-
auto wait () noexcept -> void
Causes the CPU to wait if the spin count is less than the maximum number of spins, otherwise sleeps for the kernel min sleep duration.
Public Static Functions
-
auto sleep () noexcept -> void
Puts the thread to sleep for a duration which is usually less than the minimum sleep time for the kernel, so the kernel will usually schedule this thread to sleep for the minimum duration, which is usually somewhere between 1 and 10 ms.
Public Static Attributes
-
constexpr uint32_t
max_spins
= 2000¶ Max number of spins before sleeping.
-