Sha256: 0fff13588f2f87235b52fa45cbfeda42135aab244f0cbdf4d630ed64c2ee8b2d

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

class Ring {
  class Node {
    def initialize: @next ring: @ring { }

    def count: count {
      if: @next then: {
       "." print
        @next @@ count: (count + 1)
      } else: {
        "DONE: " ++ count println
        @ring done: true
      }
      die! # let this actor die to free resources
    }
  }

  read_write_slot: 'done
  def initialize: amount {
    node = nil
    amount times: {
      node = Node new: node ring: self
    }
    @start = node
    @done = false
  }

  def start {
    @start count: 1
  }
}

# create ring and run through it
ring = Ring new: 4000
ring start
until: { ring done } do: {
  Thread sleep: 0.1
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fancy-0.4.0 examples/actors_ring.fy