#Atomic Operations with booleans

1 messages · Page 1 of 1 (latest)

dusk dagger
#

https://ziglang.org/documentation/master/#toc-atomicRmw
Documentation states that T can be a bool but operations doesn't have any information if they can be used with booleans. only enum, int and float are mentioned.
Also what does unmodified there mean?```
.Xchg - stores the operand unmodified.

valid juniper
#

xchg stores the operand at location and returns the value of the previous operand

#

it works for booleans

#
export fn @"test"(ptr: *bool) bool {
    return @atomicRmw(bool, ptr, .Xchg, true, .SeqCst);
}