Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fine-tune the Ordering for the atomic usages #1015

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/neon/src/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl InstanceId {
fn next() -> Self {
static NEXT_ID: AtomicU32 = AtomicU32::new(0);

let next = NEXT_ID.fetch_add(1, Ordering::SeqCst).checked_add(1);
let next = NEXT_ID.fetch_add(1, Ordering::Relaxed).checked_add(1);
match next {
Some(id) => Self(id),
None => panic!("u32 overflow ocurred in Lifecycle InstanceId"),
Expand Down
2 changes: 1 addition & 1 deletion crates/neon/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ use crate::lifecycle::LocalCell;
static COUNTER: AtomicUsize = AtomicUsize::new(0);

fn next_id() -> usize {
COUNTER.fetch_add(1, Ordering::SeqCst)
COUNTER.fetch_add(1, Ordering::Relaxed)
}

/// A JavaScript thread-local container that owns its contents, similar to
Expand Down
Loading