Module actix::sync

source ·
Expand description

Sync Actors support

Sync Actors are actors that run multiple instances on a thread pool. This is useful for CPU bound, or concurrent workloads. There can only be a single Sync Actor type on a SyncArbiter. This means you can’t have Actor type A and B, sharing the same thread pool. You need to create two SyncArbiters and have A and B spawn on unique SyncArbiters respectively. For more information and examples, see SyncArbiter

Structs§

  • SyncArbiter provides the resources for a single Sync Actor to run on a dedicated thread or threads. This is generally used for CPU bound concurrent workloads. It’s important to note, that the SyncArbiter generates a single address for the pool of hosted Sync Actors. Any message sent to this Address, will be operated on by a single Sync Actor from the pool.
  • Sync actor execution context. This is used instead of impl Actor for your Actor instead of Context, if you intend this actor to run in a SyncArbiter.