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

Do not crash on thread spawn error #119

Merged
merged 1 commit into from
May 24, 2024
Merged

Conversation

rhysd
Copy link
Contributor

@rhysd rhysd commented May 23, 2024

This PR proposes to allow handling errors on spawning a thread by users. By this change, user applications can determine what to do when Ctrl+C hook could not be set:

  • Do some clean up before exiting
  • Just ignore setting Ctrl+C hook and continue

I know that Rust provides an escape hatch std::panic::catch_unwind, but it is only available when panic = "unwind" and not an idiomatic error handling.

return Err(err.into());
}
}
platform::init_os_handler(overwrite)?;
Copy link
Contributor Author

@rhysd rhysd May 23, 2024

Choose a reason for hiding this comment

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

This is just a refactoring. The code before is exactly the same as the one after.

@Detegr
Copy link
Owner

Detegr commented May 24, 2024

Makes sense, thanks.

@Detegr Detegr merged commit b543abe into Detegr:master May 24, 2024
16 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.

2 participants