aboutsummaryrefslogtreecommitdiff
path: root/std/atomic/int.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-07-16 20:52:50 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-07-16 20:52:50 -0400
commit97bfeac13f89e1b5a22fcd7d4705341b4c3e1950 (patch)
tree4a3e23a8b3908450b23f2dbba72e5f6c091d7114 /std/atomic/int.zig
parent0fa24b6b7568557c29c9b3ee213ce2b06fcd6367 (diff)
downloadzig-97bfeac13f89e1b5a22fcd7d4705341b4c3e1950.tar.gz
zig-97bfeac13f89e1b5a22fcd7d4705341b4c3e1950.zip
self-hosted: create tmp dir for .o files and emit .o file for fn
Diffstat (limited to 'std/atomic/int.zig')
-rw-r--r--std/atomic/int.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/std/atomic/int.zig b/std/atomic/int.zig
index d51454c673..4103d52719 100644
--- a/std/atomic/int.zig
+++ b/std/atomic/int.zig
@@ -25,5 +25,9 @@ pub fn Int(comptime T: type) type {
pub fn get(self: *Self) T {
return @atomicLoad(T, &self.unprotected_value, AtomicOrder.SeqCst);
}
+
+ pub fn xchg(self: *Self, new_value: T) T {
+ return @atomicRmw(T, &self.unprotected_value, builtin.AtomicRmwOp.Xchg, new_value, AtomicOrder.SeqCst);
+ }
};
}