Description:
added more comments on dir_init.rb git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@383 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r180:a8ad25e1c3fc - - 1 file changed: 19 inserted, 0 deleted

@@ -9,12 +9,31
9 9 # job. Problems may occur when the first process delete the files
10 10 # while the second process is still using the files.
11 11 #
12 12 # This library maintain a reference counter on the processes using the
13 13 # directory. It locks the dir to manage critical section when
14 14 # updating the reference counter.
15 + #
16 + # Example usage:
17 + #
18 + # dman = DirInit::Manager.new("mydir")
19 + #
20 + # dman.setup do
21 + # # do some initialization
22 + # end
23 + #
24 + # #... do anything you want
25 + #
26 + # dman.teardown do
27 + # # clean up
28 + # end
29 + #
30 + # DirInit::Manager ensures that the block passed to <tt>setup</tt>
31 + # only runs once by the first process in the concurrent dir usage and
32 + # block passed to <tt>teardown</tt> runs once by the last process in
33 + # that concurrent activities leaving that dir.
15 34
16 35 module DirInit
17 36
18 37 class Manager
19 38
20 39 def initialize(dir_name, usage_filename='.usage_counter')
You need to be logged in to leave comments. Login now