@@ -27,7 +27,7 @@ const atomic = std.atomic;
27
27
/// The checking of `ptr` and `expect`, along with blocking the caller, is done atomically
28
28
/// and totally ordered (sequentially consistent) with respect to other wait()/wake() calls on the same `ptr`.
29
29
pub fn wait (ptr : * const atomic .Value (u32 ), expect : u32 ) void {
30
- @setCold ( true );
30
+ @branchHint ( .cold );
31
31
32
32
Impl .wait (ptr , expect , null ) catch | err | switch (err ) {
33
33
error .Timeout = > unreachable , // null timeout meant to wait forever
@@ -43,7 +43,7 @@ pub fn wait(ptr: *const atomic.Value(u32), expect: u32) void {
43
43
/// The checking of `ptr` and `expect`, along with blocking the caller, is done atomically
44
44
/// and totally ordered (sequentially consistent) with respect to other wait()/wake() calls on the same `ptr`.
45
45
pub fn timedWait (ptr : * const atomic .Value (u32 ), expect : u32 , timeout_ns : u64 ) error {Timeout }! void {
46
- @setCold ( true );
46
+ @branchHint ( .cold );
47
47
48
48
// Avoid calling into the OS for no-op timeouts.
49
49
if (timeout_ns == 0 ) {
@@ -56,7 +56,7 @@ pub fn timedWait(ptr: *const atomic.Value(u32), expect: u32, timeout_ns: u64) er
56
56
57
57
/// Unblocks at most `max_waiters` callers blocked in a `wait()` call on `ptr`.
58
58
pub fn wake (ptr : * const atomic .Value (u32 ), max_waiters : u32 ) void {
59
- @setCold ( true );
59
+ @branchHint ( .cold );
60
60
61
61
// Avoid calling into the OS if there's nothing to wake up.
62
62
if (max_waiters == 0 ) {
@@ -1048,7 +1048,7 @@ pub const Deadline = struct {
1048
1048
/// - A spurious wake occurs.
1049
1049
/// - The deadline expires; In which case `error.Timeout` is returned.
1050
1050
pub fn wait (self : * Deadline , ptr : * const atomic .Value (u32 ), expect : u32 ) error {Timeout }! void {
1051
- @setCold ( true );
1051
+ @branchHint ( .cold );
1052
1052
1053
1053
// Check if we actually have a timeout to wait until.
1054
1054
// If not just wait "forever".
0 commit comments