Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Private Struct

Waiter

Private Struct
std.Io.Threaded.parking_futex.Waiter
const Waiter = struct

Fields

node: std.DoublyLinkedList.Node
address: usize
tid: ParkTid
thread_status: *std.atomic.Value(Thread.Status)

thread_status.cancelation is .parked while the thread is waiting. The single thread which atomically updates it (to .none or .canceling) is responsible for:

  • Removing the Waiter from Bucket.waiters
  • Decrementing Bucket.num_waiters
  • Unparking the thread (after the above, so that the Waiter does not go out of scope while it is still in the Bucket).
unpark_flag: if (need_unpark_flag) *UnparkFlag else void

File

Io/Threaded.zig:17574
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
    const Waiter = struct {
        node: std.DoublyLinkedList.Node,
        address: usize,
        tid: ParkTid,
        /// `thread_status.cancelation` is `.parked` while the thread is waiting. The single thread
        /// which atomically updates it (to `.none` or `.canceling`) is responsible for:
        ///
        /// * Removing the `Waiter` from `Bucket.waiters`
        /// * Decrementing `Bucket.num_waiters`
        /// * Unparking the thread (*after* the above, so that the `Waiter` does not go out of scope
        ///   while it is still in the `Bucket`).
        thread_status: *std.atomic.Value(Thread.Status),
        unpark_flag: if (need_unpark_flag) *UnparkFlag else void,
    }