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

Add suspend/resume capability to dispatcher #4

Open
syntheticmagus opened this issue Aug 23, 2019 · 1 comment
Open

Add suspend/resume capability to dispatcher #4

syntheticmagus opened this issue Aug 23, 2019 · 1 comment

Comments

@syntheticmagus
Copy link
Contributor

Add the ability to suspend and resume execution from another thread by setting state (or taking a token or something) on a dispatcher, without having to interact directly with mutexes or locks.

@ryantrem
Copy link
Member

The base dispatcher class has a protected tick that derived classes call. manual_dispatcher exposes the tick publicly so the consumer can manually process queued work. For these cases, having a way to pause/resume doesn't make sense (since full control of synchronous ticking is already exposed). For background_dispatcher, tick is not exposed and all processing of the work queue is internal. For this case, I could imagine exposing a function from background_dispatcher that is something like: task<gsl::final_action<void>> pause(). The idea would be that it is an asynchronous request to pause the work queue (after finishing the current operation/tick if there is one), and returning a gsl::final_action that is used as a token such that when the caller destroys it, the work queue is resumed.

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