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

Use crossbeam_channel and stop profiling on control+c #55

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

javierhonduco
Copy link
Owner

The crossbeam_channel crate offers a couple of nice features that the standard library producer/comsumer channel doesn't have, including a select! macro that lets us poll from the first available channel when we are polling from several channels. This commit reworks this logic to unify everything using this macro, resulting in potential fewer waits in the worst case scenario and cleaner logic.

This work started to add support for SIGINT aka control+c handling, which is included in this commit. Once the signal is received, profiling will stop and the profile will be dealt with as soon as the channels are polled again.

Test Plan

Interrupted profiling with control+C without any issues, made sure it works for short and long durations to verify there are no regressions.

The `crossbeam_channel` crate offers a couple of nice features that the
standard library producer/comsumer channel doesn't have, including a
`select!` macro that lets us poll from the first available channel when
we are polling from several channels. This commit reworks this logic to
unify everything using this macro, resulting in potential fewer waits in
the worst case scenario and cleaner logic.

This work started to add support for SIGINT aka control+c handling,
which is included in this commit. Once the signal is received, profiling
will stop and the profile will be dealt with as soon as the channels are
polled again.

Test Plan
=========

Interrupted profiling with control+C without any issues, made sure it
works for short and long durations to verify there are no regressions.
@javierhonduco javierhonduco merged commit 7147112 into main Aug 12, 2024
8 checks passed
@javierhonduco javierhonduco deleted the stop-on-sigint branch August 12, 2024 14:34
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.

1 participant