Skip to content

Fix Build::compile_objects deadlock on parallel#829

Merged
thomcc merged 1 commit intorust-lang:mainfrom
NobodyXu:fix-compile-objects
Jul 20, 2023
Merged

Fix Build::compile_objects deadlock on parallel#829
thomcc merged 1 commit intorust-lang:mainfrom
NobodyXu:fix-compile-objects

Conversation

@NobodyXu
Copy link
Contributor

@NobodyXu NobodyXu commented Jul 20, 2023

jobserver::Client::acquire may block if there's not enough token.

To avoid blocking, this patch waits for child in a separate thread so that once the old compiler job is done, it may continue spawning new job instead of blocking forever.

This PR also makes sure that the released token is always re-acquired.

`jobserver::Client::acquire` may block if there's not enough token.

To avoid blocking, this patch waits for child in a separate thread so
that once the old compiler job is done, it may continue spawning new
job instead of blocking forever.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@NobodyXu
Copy link
Contributor Author

P.S. This could be much easier if stdlib provides a simple async runtime.

Copy link
Member

@thomcc thomcc left a comment

Choose a reason for hiding this comment

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

Unfortunate, but seems necessary.

@NobodyXu
Copy link
Contributor Author

NobodyXu commented Jul 20, 2023

Unfortunate, but seems necessary.

Thanks for the review, with this change it still spawns less threads than before, where two threads are spawned for every object.

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.

2 participants