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

Sleeper

Private Struct
std.Io.Dispatch.Sleeper
const Sleeper = struct

Fields

queue: c.dispatch.queue_t
fiber: *Fiber

Functions

fn init(queue: c.dispatch.queue_t, fiber: *Fiber) Sleeper
fn wake(context: ?*anyopaque) callconv(.c) void

File

Io/Dispatch.zig:793
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
const Sleeper = struct {
    queue: c.dispatch.queue_t,
    fiber: *Fiber,

    fn init(queue: c.dispatch.queue_t, fiber: *Fiber) Sleeper {
        queue.as_object().retain();
        return .{ .queue = queue, .fiber = fiber };
    }

    fn wake(context: ?*anyopaque) callconv(.c) void {
        const sleeper: *Sleeper = @ptrCast(@alignCast(context));
        const queue = sleeper.queue;
        sleeper.queue = undefined;
        queue.async(sleeper.fiber, &Fiber.@"resume");
        queue.as_object().release();
    }
}