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 stopped() instead of quit flag to exit exec loop #35

Closed
wants to merge 1 commit into from

Conversation

heifner
Copy link
Member

@heifner heifner commented Sep 30, 2024

By checking is_quitting() before calling poll() there is the possibility that something was posted but not drained to the priority queue. Instead use the io_context stopped() to break out of the loop after calling poll().

try {
io_serv.poll(); // queue up any ready; allowing high priority item to get into the queue
if (io_serv.stopped())
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should also change the is_quitting() function to return io_serv.stopped(), and remove the is_quitting bool?

Copy link
Member Author

@heifner heifner Oct 1, 2024

Choose a reason for hiding this comment

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

It uses a mutex instead of an atomic, but maybe. I don't have a strong opinion either way.

@heifner
Copy link
Member Author

heifner commented Oct 16, 2024

Included in #34

@heifner heifner closed this Oct 16, 2024
@heifner heifner deleted the quit-stop branch November 1, 2024 12:37
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