lundi 7 septembre 2020

Can I change a std::sync(std::launch::deferred policy to std::launch::async, once created?

I'm in a scenario where I have many I/O-bound tasks, nicely suited to run in background. However, I can't launch all of them in parallel.

Although I could use other tricks (eg. count semaphores), I wonder if I could change an already created std::async(deferred) (well, future, right now) policy to async each time one of the futures completes (well, kind of, but I hope you get some context).

Once I have a deferred future, the only way to start it is block until it ends (wait or get, not even wait_for). I'd just want to make it run, but without waiting for it to complete (right now; I will accept the block, but later).

Aucun commentaire:

Enregistrer un commentaire