mirror of
https://github.com/rdmsr/zag.git
synced 2026-10-27 13:58:20 +00:00
021e213fb2
Add a per-turnstile lock which is now held across propagation, instead of a per-chain lock. This should hopefully avoid scalability problems if many different turnstiles point to the same bucket.
28 lines
634 B
Zig
28 lines
634 B
Zig
const r = @import("root");
|
|
const ke = r.ke;
|
|
const kep = ke.private;
|
|
const mm = r.mm;
|
|
|
|
pub const thread = @import("thread.zig");
|
|
|
|
pub var turnstile_zone: mm.zone.TypedZone(kep.turnstile.Turnstile) = undefined;
|
|
|
|
fn turnstile_ctor(ts: *kep.turnstile.Turnstile) void {
|
|
ts.* = .{
|
|
.link = undefined,
|
|
.next_free = null,
|
|
.obj = undefined,
|
|
.queues = undefined,
|
|
.waiters = 0,
|
|
.owners = .none,
|
|
.lock = .init(),
|
|
};
|
|
ts.reset();
|
|
}
|
|
|
|
/// Initialize the process subsystem.
|
|
pub fn init() void {
|
|
turnstile_zone.init("turnstiles", .{ .ctor = turnstile_ctor });
|
|
thread.init();
|
|
}
|