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

boardd: wait for safety_setter_thread to finish while quitting panda_state_thread #21961

Merged
merged 4 commits into from
Oct 4, 2021

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented Aug 18, 2021

use std::future to wait for safety_setter_thread to finish before quitting.

safety_setter_thread should not run after panda_state_thread, or the panda could be set to nullptr

@pd0wm pd0wm added the refactor label Aug 19, 2021
@pd0wm
Copy link
Contributor

pd0wm commented Aug 31, 2021

Any reason the safety setter thread needs to be global like this? Can we make the panda_state_thread "own" the thread and join it on disconnect?

@deanlee
Copy link
Contributor Author

deanlee commented Sep 2, 2021

Any reason the safety setter thread needs to be global like this? Can we make the panda_state_thread "own" the thread and join it on disconnect?

std::future<bool> safety_future is used for this purpose.it's owned by panda_state_thread and will "join" the safety_setter_thread in destructor before the panda_state_thread return.

@pd0wm
Copy link
Contributor

pd0wm commented Oct 4, 2021

Thanks for rebasing!

@pd0wm
Copy link
Contributor

pd0wm commented Oct 4, 2021

While testing I noticed the thread never finishes if you go offroad before the fingerprinting finishes. The panda state threat then puts you back in noOutput and you're stuck. The safety setter thread should also exit when ignition goes low.

@pd0wm pd0wm merged commit 47f601e into commaai:master Oct 4, 2021
@pd0wm
Copy link
Contributor

pd0wm commented Oct 4, 2021

#22426

@deanlee deanlee deleted the safety_thread branch October 4, 2021 12:41
@deanlee
Copy link
Contributor Author

deanlee commented Oct 4, 2021

Just realized this is my 500th PR:)

@pd0wm
Copy link
Contributor

pd0wm commented Oct 4, 2021

Congrats! Thanks for all the contributions!

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.

2 participants