lib/rex/sync/ref.rb in librex-0.0.68 vs lib/rex/sync/ref.rb in librex-0.0.70

- old
+ new

@@ -9,50 +9,50 @@ # use. # ### module Ref - # - # Initializes the reference count to one. - # - def refinit - @_references = 1 - @_references_mutex = Mutex.new + # + # Initializes the reference count to one. + # + def refinit + @_references = 1 + @_references_mutex = Mutex.new - self - end + self + end - # - # Increments the total number of references. - # - def ref - @_references_mutex.synchronize { - @_references += 1 - } + # + # Increments the total number of references. + # + def ref + @_references_mutex.synchronize { + @_references += 1 + } - self - end + self + end - # - # Decrements the total number of references. If the reference count - # reaches zero, true is returned. Otherwise, false is returned. - # - def deref - @_references_mutex.synchronize { - if ((@_references -= 1) == 0) - cleanup + # + # Decrements the total number of references. If the reference count + # reaches zero, true is returned. Otherwise, false is returned. + # + def deref + @_references_mutex.synchronize { + if ((@_references -= 1) == 0) + cleanup - true - else - false - end - } - end + true + else + false + end + } + end - # - # Called to clean up resources once the ref count drops to zero. - # - def cleanup - end + # + # Called to clean up resources once the ref count drops to zero. + # + def cleanup + end end end