Skip to content

Commit 2c5587e

Browse files
committed
Add atomic_shim impl for fetch_max on AtomicI64 as well
1 parent c420b01 commit 2c5587e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/atomic_shim.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ mod shim {
237237
*lock = prev ^ val;
238238
prev
239239
}
240+
241+
#[allow(dead_code)]
242+
pub fn fetch_max(&self, val: i64, _: Ordering) -> i64 {
243+
let mut lock = self.value.write();
244+
let prev = *lock;
245+
*lock = prev.max(val);
246+
prev
247+
}
240248
}
241249

242250
impl From<i64> for AtomicI64 {

0 commit comments

Comments
 (0)