Skip to content

refactor: migrate to Zig 0.16.0-dev.2676 PriorityQueue API#1

Merged
GrapeBaBa merged 1 commit intomainfrom
grapebaba/condescending-feistel
Feb 28, 2026
Merged

refactor: migrate to Zig 0.16.0-dev.2676 PriorityQueue API#1
GrapeBaBa merged 1 commit intomainfrom
grapebaba/condescending-feistel

Conversation

@GrapeBaBa
Copy link
Collaborator

  • Rename PriorityQueue methods: init→initContext, add→push, remove→pop, removeIndex→popIndex, deinit now takes allocator
  • Add self.* = undefined in EventClock.deinit for memory poisoning
  • Split triple compound condition in SlotClock AdvanceIterator
  • Update workaround comments for macOS GCD bug #31307

Copilot AI review requested due to automatic review settings February 28, 2026 10:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the clock/event loop implementation to Zig 0.16.0-dev.2676 by updating std.PriorityQueue usage and related cleanup, while also improving some internal safety/clarity in deinit paths and iterator logic.

Changes:

  • Updated std.PriorityQueue usage in EventClock to the new API (initContext, push, pop, popIndex, deinit(allocator)).
  • Added memory poisoning in EventClock.deinit (self.* = undefined) after releasing resources.
  • Refactored SlotClock.AdvanceIterator epoch-boundary condition into clearer nested optionals and refreshed macOS GCD workaround comments/tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/SlotClock.zig Refactors epoch-boundary detection in AdvanceIterator to avoid triple-compound optional checks.
src/EventClock.zig Migrates waiter priority queue calls to Zig 0.16 API; adjusts deinit, comments, and a real-time test name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 450 to 452
) catch {
// Transient error — re-check stopped flag.
continue;
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std.Io.sleep errors are being swallowed silently here. If sleep starts failing persistently (e.g., due to an I/O subsystem issue), the loop will tight-spin and provide no diagnostic signal. Consider capturing the error (catch |err|) and either logging it (ideally rate-limited) and/or stopping the loop on non-transient errors to avoid high CPU usage and invisible failures.

Suggested change
) catch {
// Transient error — re-check stopped flag.
continue;
) catch |err| {
std.log.err("EventClock: std.Io.sleep failed: {s}; stopping auto loop to avoid spin", .{@errorName(err)});
self.stop();
break;

Copilot uses AI. Check for mistakes.
@GrapeBaBa GrapeBaBa force-pushed the grapebaba/condescending-feistel branch from 90a18c2 to 83585d4 Compare February 28, 2026 10:33
- Rename PriorityQueue methods: init→initContext, add→push,
  remove→pop, removeIndex→popIndex, deinit now takes allocator
- Add self.* = undefined in EventClock.deinit for memory poisoning
- Split triple compound condition in SlotClock AdvanceIterator
- Update workaround comments for macOS GCD bug #31307
@GrapeBaBa GrapeBaBa force-pushed the grapebaba/condescending-feistel branch from 83585d4 to 915ca21 Compare February 28, 2026 10:35
@GrapeBaBa GrapeBaBa merged commit f35f551 into main Feb 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants