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

refactor scheduler #2699

Merged
merged 9 commits into from
Dec 1, 2022
Merged

refactor scheduler #2699

merged 9 commits into from
Dec 1, 2022

Conversation

RalfJung
Copy link
Member

Refactors the scheduler to use something akin to a generator -- a callback that will be invoked when the stack of a thread is empty, which has the chance to push a new stack frame or do other things and then indicates whether this thread is done, or should be scheduled again. (Unfortunately I think we cannot use actual generators here.) The interpreter loop is now a proper infinite loop, the only way to leave it is for some kind of interrupt to be triggered (represented as InterpError) -- unifying how we handle 'exit when calling process::exit' and 'exit when main thread quits'.

The last commit implements an alternative approach to #2660 using this new structure. Fixes #2629.

@RalfJung
Copy link
Member Author

RalfJung commented Dec 1, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Dec 1, 2022

📌 Commit 7453d7e has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Dec 1, 2022

⌛ Testing commit 7453d7e with merge 837c679...

@bors
Copy link
Contributor

bors commented Dec 1, 2022

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 837c679 to master...

1 similar comment
@bors
Copy link
Contributor

bors commented Dec 1, 2022

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 837c679 to master...

@bors bors merged commit 837c679 into rust-lang:master Dec 1, 2022
@RalfJung RalfJung deleted the schedule-refactor branch December 2, 2022 12:51
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.

scoped threads vs thread leaks
3 participants