std: remove atomic.Stack

This was originally supposed to be a lock-free stack, but I gave up on
that and made it be a thread-safe stack which is implemented poorly
using spin locks. Nobody should use this data structure.

The alternative is a normal stack protected by a mutex.
This commit is contained in:
Andrew Kelley
2023-11-22 16:37:14 -07:00
parent 1fa2e911d9
commit 6bd97ab640
3 changed files with 5 additions and 186 deletions
+5 -7
View File
@@ -1,16 +1,9 @@
const std = @import("std.zig");
const builtin = @import("builtin");
pub const Stack = @import("atomic/stack.zig").Stack;
pub const Queue = @import("atomic/queue.zig").Queue;
pub const Atomic = @import("atomic/Atomic.zig").Atomic;
test {
_ = @import("atomic/stack.zig");
_ = @import("atomic/queue.zig");
_ = @import("atomic/Atomic.zig");
}
/// Signals to the processor that the caller is inside a busy-wait spin-loop.
pub inline fn spinLoopHint() void {
switch (builtin.target.cpu.arch) {
@@ -90,3 +83,8 @@ pub const cache_line = switch (builtin.cpu.arch) {
// - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/internal/cpu/cpu_wasm.go#L7
else => 64,
};
test {
_ = Queue;
_ = Atomic;
}