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

Fix #1064 #1065

Closed
wants to merge 3 commits into from
Closed

Fix #1064 #1065

wants to merge 3 commits into from

Conversation

Pr0methean
Copy link

Fixes #1064 by preventing two jobs on the same thread from yielding at once.

@@ -857,19 +865,37 @@ impl WorkerThread {
}

pub(super) fn yield_now(&self) -> Yield {
let yielding = &self.registry.thread_infos[self.index].is_yielding;
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems this could just be a Cell<bool> in WorkerThread (since that's where the thread-local stuff generally lives) instead of living on the registry?

Copy link
Member

@cuviper cuviper left a comment

Choose a reason for hiding this comment

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

I don't agree that this is something we should block, but I'll write more in #1064.

@@ -468,4 +468,7 @@ pub enum Yield {
Executed,
/// No available work was found.
Idle,
/// Another job that has yielded is already on this thread's stack, so to prevent a stack
/// overflow we will not start a third job.
Recursive,
Copy link
Member

Choose a reason for hiding this comment

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

This is a breaking change, because we didn't make it #[non_exhaustive].

@cuviper cuviper closed this Sep 2, 2023
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.

yield_local can cause stack overflow
3 participants