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

common/params: move blocking read functionality to Cython #32367

Closed
wants to merge 1 commit into from

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented May 7, 2024

The current C++ blocking read have signal handling issues:

  1. Its custom signal handler prevents other modules from receiving SIGINT/SIGTERM signals during blocking read, leading to improper termination.
  2. When multiple blocking reads occur concurrently in different threads, the later-read thread might restore the signal handler to the params_sig_handler installed by the preceding blocking read. This action permanently disables the default signal handler or the handler set up by the program, leading to improper signal handling within the program after blocking reads.

this PR replaces the problematic C++ blocking reads with Cython implementation. This new implementation delegates the handling of SIGINT and SIGTERM signals to Python's built-in mechanisms, ensuring smoother interruption management.

While this PR removes C++ support for blocking reads, performing them in C++ remains straightforward:

while (!exit) {
  val = params.read(key);
  if (!val.empty()) break;
  util::sleep_for(100);
}

Copy link
Contributor

github-actions bot commented May 7, 2024

Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following:

  • Convert your PR to a draft unless it's ready to review
  • Read the contributing docs
  • Before marking as "ready for review", ensure:
    • the goal is clearly stated in the description
    • all the tests are passing
    • the change is something we merge
    • include a route or your device' dongle ID if relevant

Copy link
Contributor

This PR has had no activity for 14 days. It will be automatically closed in 3 days if there is no activity.

@github-actions github-actions bot added the stale label May 22, 2024
@github-actions github-actions bot removed the stale label May 26, 2024
Copy link
Contributor

github-actions bot commented Jun 9, 2024

This PR has had no activity for 14 days. It will be automatically closed in 3 days if there is no activity.

@github-actions github-actions bot added the stale label Jun 9, 2024
Copy link
Contributor

This PR has been automatically closed due to inactivity. Feel free to re-open once activity resumes.

@github-actions github-actions bot closed this Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant