Skip to content

InitOnce: synchronize with completion when already complete#2641

Merged
bors merged 3 commits into
rust-lang:masterfrom
beepster4096:init_once_acquire
Nov 4, 2022
Merged

InitOnce: synchronize with completion when already complete#2641
bors merged 3 commits into
rust-lang:masterfrom
beepster4096:init_once_acquire

Conversation

@beepster4096

Copy link
Copy Markdown
Contributor

The completion of an InitOnce happens-before the threads waiting on it wake up. However, this is not the case for threads that call InitOnceBeginInitialize after the completion, leading to data races and outdated weak memory loads as observed in the CI for #2638. This PR fixes this.

Comment thread src/concurrency/init_once.rs Outdated
Comment thread src/concurrency/init_once.rs Outdated
Comment thread src/shims/windows/sync.rs Outdated
Comment thread tests/pass/concurrency/windows_init_once.rs
Comment thread tests/pass/concurrency/windows_init_once.rs Outdated
Comment thread src/concurrency/init_once.rs Outdated
@RalfJung

RalfJung commented Nov 4, 2022

Copy link
Copy Markdown
Member

Thanks, looks good!
@bors r+

@bors

bors commented Nov 4, 2022

Copy link
Copy Markdown
Contributor

📌 Commit bc05e6b has been approved by RalfJung

It is now in the queue for this repository.

@bors

bors commented Nov 4, 2022

Copy link
Copy Markdown
Contributor

⌛ Testing commit bc05e6b with merge 9568d7e...

@bors

bors commented Nov 4, 2022

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 9568d7e to master...

@bors bors merged commit 9568d7e into rust-lang:master Nov 4, 2022
Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 11, 2022
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Nov 15, 2022
spikespaz pushed a commit to spikespaz/dotwalk-rs that referenced this pull request Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants