c++-actor-framework

Can all actors in an actor_system be suspended/resumed?


My goal is to create a command line utility app which uses CAF for concurrency and I would like to support pausing and resuming the utility by capturing input from the console (ie. ctrl-c, etc).

Does CAF expose/support a mechanism for pausing/suspending the behavior of all actors in an actor_system? If so, is there also a way to notify the actor_system to resume from where it was suspended?


Solution

  • No, CAF does support suspending actors. The closest thing CAF could offer is to allow users to stop/resume the scheduler. However, detached actors run in their own threads. Brokers also don't use the scheduler and run in an I/O event-loop instead.

    Do you have non-CAF parts of your application that need to run independently? Otherwise you could just suspend the process at OS level (e.g. via CTRL+Z).