Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: align MPSC queue with standard head/tail naming #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Hanaasagi
Copy link

Rename head and tail pointer operations in the MPSC queue to align with standard queue semantics. Producers now push to the tail, and the consumer pops from the head, ensuring correct behavior and improving code clarity.

This change also aligns the implementation with the one in queue.zig, maintaining consistency across the project.

libxev/src/queue.zig

Lines 18 to 35 in b8d1d93

/// Head is the front of the queue and tail is the back of the queue.
head: ?*T = null,
tail: ?*T = null,
/// Enqueue a new element to the back of the queue.
pub fn push(self: *Self, v: *T) void {
assert(v.next == null);
if (self.tail) |tail| {
// If we have elements in the queue, then we add a new tail.
tail.next = v;
self.tail = v;
} else {
// No elements in the queue we setup the initial state.
self.head = v;
self.tail = v;
}
}
.

Rename head and tail pointer operations in the MPSC queue to align with standard queue semantics.
Producers now push to the tail, and the consumer pops from the head, ensuring correct behavior and improving code clarity.
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.

1 participant