Skip to content

threading: improve safety posture of modifying global bindings #35761

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

Merged
merged 1 commit into from
May 6, 2020

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented May 5, 2020

Ensures that we are holding some lock (a new one) while mutating the
internal global jl_current_modules table.

While reading these binding values is not memory-safe to do
simultaneously (it may invent pointers from thin-air and segfault), this
commit ensures that a data conflict during the writes to them will
not corrupt the values written into memory.

This is some of the non-controversial content extracted from #35535. While it doesn't make particularly useful promises without the rest of that PR (docs here are updated accordingly), it is a much smaller semantic change.

Ensures that we are holding some lock (a new one) while mutating the
internal global `jl_current_modules` table.

While reading these binding values is not memory-safe to do
simultaneously (it may invent pointers from thin-air and segfault), this
commit ensures that a data conflict during the writes to them will
not corrupt the values written into memory.
@JeffBezanson JeffBezanson added the multithreading Base.Threads and related functionality label May 5, 2020
@JeffBezanson JeffBezanson merged commit a4641c8 into master May 6, 2020
@JeffBezanson JeffBezanson deleted the jn/module-lock-global-writes branch May 6, 2020 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants