Actor

ox.channels.Actor
object Actor

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Actor.type

Members list

Value members

Concrete methods

def create[T](logic: T, close: Option[T => Unit])(using ox: Ox, sc: BufferCapacity): ActorRef[T]

Creates a new actor, that is a fork in the current concurrency scope, which protects a mutable resource (logic) and executes invocations on it serially, one after another. It is guaranteed that logic will be accessed by at most one thread at a time. The methods of logic: T define the actor's interface (the messages that can be "sent to the actor").

Creates a new actor, that is a fork in the current concurrency scope, which protects a mutable resource (logic) and executes invocations on it serially, one after another. It is guaranteed that logic will be accessed by at most one thread at a time. The methods of logic: T define the actor's interface (the messages that can be "sent to the actor").

Invocations can be scheduled using the returned ActorRef. When an invocation is an ActorRef.ask, any non-fatal exceptions are propagated to the caller, and the actor continues. Fatal exceptions, or exceptions that occur during ActorRef.tell invocations, cause the actor's channel to be closed with an error, and are propagated to the enclosing scope.

The actor's mailbox (incoming channel) will have a capacity as specified by the BufferCapacity in scope.

Attributes