Closed ilpropheta closed 1 year ago
Hi!
can you confirm that so_evt_finish won't be called until so_evt_start returns?
Yes. so_evt_start and so_evt_finish are called as the result of processing special hidden events evt_start and evt_finish that are sent to the agent the usual way. So, evt_finish can't be extracted from agent's queue until so_evt_start returns.
Does it make sense? Is that an acceptable design?
Yes, sometimes I use something like that (but without std::stop_token, because we haven't switched to C++20 yet).
Thanks @eao197!
Hi, quick one: can you confirm that
so_evt_finish
won't be called untilso_evt_start
returns?Imagine this scenario:
I expect that
some_agent
hangs forever. One solution is to inject the stop_token into the constructor and to request stop from outside. For example:Does it make sense? I know that a thread would be a better fit (
std::jthread
in particular) than usingagent_t
here. However, this way my design stays consistent, the dispatching policy is configured as usual, and everything is managed by the environment. So this has some advantages. Which are your thoughts? Is that an acceptable design?Many thanks!