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

Busy looping when waiting for subprocess to finish #70

Open
landersson opened this issue Aug 26, 2021 · 1 comment
Open

Busy looping when waiting for subprocess to finish #70

landersson opened this issue Aug 26, 2021 · 1 comment

Comments

@landersson
Copy link

Hi,

I just noticed that my program is busy-looping and thus using up a lot of CPU resources while waiting for a subprocess to finish. I'm using the Popen class. The root cause seems to be that waitpid() is used with the WNOHANG option in the util::wait_for_child_exit(int pid) function.

Why is WNOHANG being used? Is there a way to avoid busy-looping while waiting for a subprocess to finish?

@bcov77
Copy link

bcov77 commented Jan 27, 2022

Better to add a usleep() to wait_for_child_exit() so the other issue about timeouts can be dealt with.

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

No branches or pull requests

2 participants