actors :: ThreadRing :: defaultinit
# 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