Sha256: 1a5f1ed6d7a82784dc72076d464928cf3a573971f2bd220f13c39556cab6e3e5
Contents?: true
Size: 534 Bytes
Versions: 3
Compression:
Stored size: 534 Bytes
Contents
# Does the same as actors_primitive.fy but using # normal objects as actors by sending messages asynchronously (via @@ syntax). class PingPong { def initialize: @block { } def count: count reply: other notify: parent { @block call if: (count > 1000) then: { count println parent run } else: { other @@ count: (count + 1) reply: self notify: parent } } } pong = PingPong new: { "-" print } ping = PingPong new: { "." print } ping @@ count: 1 reply: pong notify: $ Thread current Thread stop
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fancy-0.7.0 | examples/actors.fy |
fancy-0.6.0 | examples/actors.fy |
fancy-0.5.0 | examples/actors.fy |