WIOService: stop does not stop if a callback is scheduled?
Added by Emeric Poupon over 4 years ago
Hello,
AFAIU, it looks like WIoService::stop() will block until the scheduled functions (using WIoService::schedule()) are triggered.
Maybe it would make sense to keep track of them in an unordered_set and just fire cancel() when stop() is called?
What do you think?
Replies (1)
RE: WIOService: stop does not stop if a callback is scheduled? - Added by Roel Standaert over 4 years ago
I'm not sure what the consequences of that would be. It appears at first glance that Wt itself does not rely on the current behavior, but I don't know about any users of Wt that may rely on that fact. It would be safer to have something like that as an opt-in thing. It is of course always possible to create your own timer and async_wait
on that instead of using schedule
, if you need to be able to cancel your own tasks, since WIOService
extends asio::io_service
.