Zig 0.17.0-dev (Split by item) 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.
std › Io › Threaded › eventWait Private Function eventWait Doc Source Private Function std.Io.Threaded.eventWait
fn eventWait (event : *Io .Event ) void Params File Io/Threaded.zig: 18981
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995 fn eventWait (event : *Io .Event ) void {
if (@cmpxchgStrong (Io .Event , event , .unset , .waiting , .acquire , .acquire )) |prev | switch (prev ) {
.unset => unreachable ,
.waiting => {},
.is_set => return ,
};
while (true ) {
Thread .futexWaitUncancelable (@ptrCast (event ), @backingInt (Io .Event .waiting ), null );
switch (@atomicLoad (Io .Event , event , .acquire )) {
.unset => unreachable , // `reset` called before pending `wait` returned
.waiting => continue ,
.is_set => return ,
}
}
}
Same as
Io.Event.waitbut avoids the VTable.