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