rework std.atomic
* move std.atomic.Atomic to std.atomic.Value * fix incorrect argument order passed to testing.expectEqual * make the functions be a thin wrapper over the atomic builtins and stick to the naming conventions. * remove pointless functions loadUnchecked and storeUnchecked. Instead, name the field `raw` instead of `value` (which is redundant with the type name). * simplify the tests by not passing every possible combination. Many cases were iterating over every possible combinations but then not even using the for loop element value! * remove the redundant compile errors which are already implemented by the language itself. * remove dead x86 inline assembly. this should be implemented in the language if at all.
This commit is contained in:
@@ -375,7 +375,7 @@ pub fn panicExtra(
|
||||
|
||||
/// Non-zero whenever the program triggered a panic.
|
||||
/// The counter is incremented/decremented atomically.
|
||||
var panicking = std.atomic.Atomic(u8).init(0);
|
||||
var panicking = std.atomic.Value(u8).init(0);
|
||||
|
||||
// Locked to avoid interleaving panic messages from multiple threads.
|
||||
var panic_mutex = std.Thread.Mutex{};
|
||||
@@ -448,7 +448,7 @@ fn waitForOtherThreadToFinishPanicking() void {
|
||||
if (builtin.single_threaded) unreachable;
|
||||
|
||||
// Sleep forever without hammering the CPU
|
||||
var futex = std.atomic.Atomic(u32).init(0);
|
||||
var futex = std.atomic.Value(u32).init(0);
|
||||
while (true) std.Thread.Futex.wait(&futex, 0);
|
||||
unreachable;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user