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

Acquire the global lock before initializing malloc #410

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

MoritzS
Copy link
Contributor

@MoritzS MoritzS commented Apr 19, 2023

In a multi-threaded execution we need to make sure that only exactly one thread initializes malloc. The function try_init_allocator() can't easily be made thread-safe, so just move the call to try_init_allocator() inside the block that holds the lock.

Copy link
Contributor

@yamt yamt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

In a multi-threaded execution we need to make sure that only exactly one
thread initializes malloc. The function try_init_allocator() can't
easily be made thread-safe, so just move the call to
try_init_allocator() inside the block that holds the lock.
@abrown abrown merged commit ba5318e into WebAssembly:main Jul 11, 2023
8 checks passed
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