tiny.simd.PoolConfig
Defined in thread.pool.
API (5)
Actions
Public operations.
Fields and members
Public fields and members.
Source
Source: lib/simd/src/thread/pool.zig:43
zig
pub const Config = struct { spin_type: spin.SpinType = .pause, wait_type: WaitType = .spin_separate, reserved: [2]u8 = @splat(0), pub fn formatName( self: Config, storage: []u8, ) error{NoSpaceLeft}![]const u8 { return std.fmt.bufPrint( storage, "{s:<14} {s:<9}", .{ spin.name(self.spin_type), waitName(self.wait_type) }, ); } pub fn candidates( mode: PoolWaitMode, storage: *[max_configs]Config, ) []const Config { return switch (mode) { .block => blk: { storage[0] = .{ .wait_type = .block }; break :blk storage[0..1]; }, .spin => blk: { const detected = spin.detectSpin(0); const spin_types: [2]spin.SpinType = .{ detected, .pause }; const spin_count: usize = if (detected == .pause) 1 else 2; var count: usize = 0; for (spin_types[0..spin_count]) |spin_type| { storage[count] = .{ .spin_type = spin_type, .wait_type = .spin_shared, }; count += 1; storage[count] = .{ .spin_type = spin_type, .wait_type = .spin_separate, }; count += 1; } break :blk storage[0..count]; }, }; } fn encode(self: Config) u16 { return @as(u16, @backingInt(self.spin_type)) | @as(u16, @backingInt(self.wait_type)) << 8; } fn decode(bits: u16) Config { return .{ .spin_type = @fromBackingInt(@intCast(@as(u8, @truncate(bits)))), .wait_type = @fromBackingInt(@intCast(@as(u8, @truncate(bits >> 8)))), }; }};Source: lib/simd/src/root.zig:130
zig
pub const PoolConfig = thread.PoolConfig;Also reachable as
Audit
| Definitions | 3 |
|---|---|
| Public names | 9 |
| Members | 3 |
| Version | 26.7.0 |
| Revision | daab053ee433 |