DEV Community

chenge
chenge

Posted on

Implements Erlang Process using Ruby -- spawn, receive, scheduler

This is written by others, I think it's fun so post it here.


require "./erl_scheduler"
require "./erl_process"

scheduler = ErlScheduler.new
counter = scheduler.spawn(Counter)

10000.times do |i|
  scheduler.send_message(counter, :inc)
end

scheduler.send_message(counter, :stop)
scheduler.loop

translated link -->

Top comments (0)