unindent most files
[rainbows.git] / lib / rainbows / actor_spawn.rb
blob2b42b6814889d3bb1d3edfec4589f87bbe529d2b
1 # -*- encoding: binary -*-
3 require 'actor'
5 # Actor concurrency model for Rubinius.  We can't seem to get message
6 # passing working right, so we're throwing a Mutex into the mix for
7 # now.  Hopefully somebody can fix things for us.  Currently, this is
8 # exactly the same as the ThreadSpawn model since we don't use the
9 # message passing capabilities of the Actor model (and even then
10 # it wouldn't really make sense since Actors in Rubinius are just
11 # Threads underneath and our ThreadSpawn model is one layer of
12 # complexity less.
14 # This is different from the Revactor one which is not prone to race
15 # conditions within the same process at all (since it uses Fibers).
16 module Rainbows::ActorSpawn
17   include Rainbows::ThreadSpawn
19   # runs inside each forked worker, this sits around and waits
20   # for connections and doesn't die until the parent dies (or is
21   # given a INT, QUIT, or TERM signal)
22   def worker_loop(worker) # :nodoc:
23     Rainbows::Const::RACK_DEFAULTS["rack.multithread"] = true # :(
24     init_worker_process(worker)
25     accept_loop(Actor)
26   end
27 end