lib/forkhandle.rb in forkhandle-0.0.1 vs lib/forkhandle.rb in forkhandle-0.0.2
- old
+ new
@@ -1,33 +1,14 @@
-# managing connection across forks and threads is tricky. most libraries use
-# and icky idiom that requires each and every client to configure it's own
-# forking logic, something like
-#
-# MyLameLib.after_for do
-# # close handles you should close
-# end
-#
-# many libs also do not provide you with per-thread connection, making MT a
-# manual process.
-#
-# a teeny bit of code can solve both. the concept is simple:
-#
-# maintain a table of connections scoped by process id and thread id. any
-# miss will trigger auto-scrubbing the table, but only connections from
-# another process (we've been forked) will be closed. this gives
-#
-# * per thread connections
-#
-# * per process connections
-#
-# * auto-matic cleanup after a fork
-#
module ForkHandle
def version
- '0.0.1'
+ '0.0.2'
end
+ def description
+ "a teeny library / design pattern for managing connections in a process and thread safe fashion"
+ end
+
@handles = Hash.new
@pid = Process.pid
@tid = Thread.current.object_id
attr_accessor :handles
@@ -82,15 +63,5 @@
extend(ForkHandle)
end
Forkhandle = ForkHandle
-
-
-__END__
-
-ForkHandle.get(:default){ build_default_connection }
-
-ForkHandle.set(:default, build_default_connection)
-
-
-