Sha256: d33f2d48a1767ac6cdd6563ec3db5ae3b068c501f169a438f1c4f629bf0975a2

Contents?: true

Size: 479 Bytes

Versions: 6

Compression:

Stored size: 479 Bytes

Contents

pong = nil
done = false
Parent = Thread current

ping = Actor spawn: {
  loop: {
    count = Actor receive
    "." print
    { count println; done = true; break } if: (count > 1000)
    pong ! (count + 1)
  }
  Parent run
}

pong = Actor spawn: {
  loop: {
    count = Actor receive
    "-" print
    { count println; done = true; break } if: (count > 1000)
    ping ! (count + 1)
  }
  Parent run
}

ping ! 1

# Let the actors process while the main thread sleeps...
Thread stop

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fancy-0.10.0 examples/actors_primitive.fy
fancy-0.9.0 examples/actors_primitive.fy
fancy-0.8.0 examples/actors_primitive.fy
fancy-0.7.0 examples/actors_primitive.fy
fancy-0.6.0 examples/actors_primitive.fy
fancy-0.5.0 examples/actors_primitive.fy