Skip to content

Instantly share code, notes, and snippets.

View zmalltalker's full-sized avatar

Marius Mathiesen zmalltalker

View GitHub Profile
@ryanlecompte
ryanlecompte / gist:2280799
Created April 2, 2012 04:41
Example of a preforking server that uses threads instead of Kernel#fork
require 'socket'
require 'thread'
# Example of a "threaded preforking" server using multiple acceptor threads
# and a pool of worker threads to service the actual requests. Note
# that this is similar to a real preforking server that uses Kernel#fork
# to service requests concurrently with a single listener socket. The only
# difference is that instead of multiple forked processes, we use multiple
# acceptor threads.
class Server