Update global-variable.md(next_id取值错误?)

Atomic*::fetch_* 函数返回值为上一个值,next_id的取值是不是错了?
pull/1274/head
蛋疼的蛋蛋 1 year ago committed by GitHub
parent 9e05a2a928
commit 5c511c36e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -93,7 +93,8 @@ fn generate_id()->usize{
if current_val > MAX_ID{
panic!("Factory ids overflowed");
}
let next_id = GLOBAL_ID_COUNTER.fetch_add(1, Ordering::Relaxed);
GLOBAL_ID_COUNTER.fetch_add(1, Ordering::Relaxed)
let next_id = GLOBAL_ID_COUNTER.load(Ordering::Relaxed);
if next_id > MAX_ID{
panic!("Factory ids overflowed");
}

Loading…
Cancel
Save