mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
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:
+5
-7
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user