mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 13:30:45 +00:00
std/event: fix zig fmt regression
This commit is contained in:
parent
1b34365ca1
commit
504f259c24
@ -773,7 +773,7 @@ pub const Loop = struct {
|
||||
self.delay_queue.waiters.insert(&entry);
|
||||
|
||||
// Speculatively wake up the timer thread when we add a new entry.
|
||||
// If the timer thread is sleeping on a longer entry, we need to
|
||||
// If the timer thread is sleeping on a longer entry, we need to
|
||||
// interrupt it so that our entry can be expired in time.
|
||||
self.delay_queue.event.set();
|
||||
}
|
||||
@ -785,7 +785,7 @@ pub const Loop = struct {
|
||||
thread: *std.Thread,
|
||||
event: std.AutoResetEvent,
|
||||
is_running: bool,
|
||||
|
||||
|
||||
/// Initialize the delay queue by spawning the timer thread
|
||||
/// and starting any timer resources.
|
||||
fn init(self: *DelayQueue) !void {
|
||||
@ -800,7 +800,7 @@ pub const Loop = struct {
|
||||
};
|
||||
}
|
||||
|
||||
/// Entry point for the timer thread
|
||||
/// Entry point for the timer thread
|
||||
/// which waits for timer entries to expire and reschedules them.
|
||||
fn run(self: *DelayQueue) void {
|
||||
const loop = @fieldParentPtr(Loop, "delay_queue", self);
|
||||
@ -848,12 +848,12 @@ pub const Loop = struct {
|
||||
const entry = self.peekExpiringEntry() orelse return null;
|
||||
if (entry.expires > now)
|
||||
return null;
|
||||
|
||||
|
||||
assert(self.entries.remove(&entry.node));
|
||||
return entry;
|
||||
}
|
||||
|
||||
/// Returns an estimate for the amount of time
|
||||
|
||||
/// Returns an estimate for the amount of time
|
||||
/// to wait until the next waiting entry expires.
|
||||
fn nextExpire(self: *Waiters) ?u64 {
|
||||
const entry = self.peekExpiringEntry() orelse return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user