actors :: ThreadRing
actors :: ThreadRing :: async
actors :: ThreadRing :: defaultinit
actors :: ThreadRing :: next=
The next Actor to whichself
send the token
actors :: ThreadRing :: send_token
Receive a token, then send it tonext
unless its value is 0
actors $ ThreadRing :: SELF
Type of this instance, automatically specialized in every classactors :: ThreadRing :: async
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
actors :: ThreadRing :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
actors :: ThreadRing :: next=
The next Actor to whichself
send the token
core :: Object :: output_class_name
Display class name on stdout (debug only).actors :: ThreadRing :: send_token
Receive a token, then send it tonext
unless its value is 0
# One Actor, who will receive the token
class ThreadRing
actor
# Identification of `self`
var id: Int
# The next Actor to which `self` send the token
var next: ThreadRing is noinit
# Receive a token, then send it to `next` unless its value is `0`
fun send_token(message: Int) do
if message == 0 then print id
if message >= 1 then next.async.send_token(message - 1)
end
end
lib/actors/examples/thread-ring/thread_ring.nit:24,1--39,3