Class: Actor

Place Revactor modules and classes under the Actor namespace

Child modules and classes

Class Actor::Mailbox
Class Actor::Scheduler

Constants

NameValue
TCP Revactor::TCP unless defined? Actor::TCP
Filter Revactor::Filter unless defined? Actor::Filter
Delegator Revactor::Delegator unless defined? Actor::Delegator

Aliases

Old nameNew name
to_s inspect

Attributes

NameRead/write?
fiber R
mailbox R
scheduler R

Public Class Methods


[] (key)

Look up an actor in the global dictionary


[]= (key, actor)

Register this actor in the global dictionary


current ()

Obtain a handle to the current Actor


delete (key, &block)

Delete an actor from the global dictionary


link (actor)

Link the current Actor to another one



receive (&filter)

Wait for messages matching a given filter. The filter object is yielded to be block passed to receive. You can then invoke the when argument which takes a parameter and a block. Messages are compared (using ===) against the parameter. The Case gem includes several tools for matching messages using ===

The first filter to match a message in the mailbox is executed. If no filters match then the actor sleeps.


reschedule ()

Reschedule the current actor for execution later


scheduler ()

Obtain a handle to the current Scheduler


sleep (seconds)

Sleep for the specified number of seconds


spawn (*args, &block)

Create a new Actor with the given block and arguments


spawn_link (*args, &block)

Spawn an Actor and immediately link it to the current one


unlink (actor)

Unlink the current Actor from another one

Protected Class Methods


Public Instance Methods


<< (message)

Send a message to an actor


[] (key)

Look up value in the actor‘s dictionary


[]= (key, value)

Store a value in the actor‘s dictionary


dead? ()

Is the current actor dead?


delete (key, &block)

Delete a value from the actor‘s dictionary


link (actor)

Establish a bidirectional link to the given Actor and notify it of any system events which occur in this Actor (namely exits due to exceptions)


notify_exited (actor, reason)

Notify this actor that one of the Actors it‘s linked to has exited


notify_link (actor)

Notify this actor that it‘s now linked to the given one


notify_unlink (actor)

Notify this actor that it‘s now unlinked from the given one


send (message)

Alias for #<<


trap_exit= (value)

Actors trapping exit do not die when an error occurs in an Actor they are linked to. Instead the exit message is sent to their regular mailbox in the form [:exit, actor, reason]. This allows certain Actors to supervise sets of others and restart them in the event of an error.


trap_exit? ()

Is the Actor trapping exit?


unlink (actor)

Unestablish a link with the given actor

Protected Instance Methods


process_events ()

Process the Actor‘s system event queue