lib/tsafe_mrswlock.rb in tsafe-0.0.5 vs lib/tsafe_mrswlock.rb in tsafe-0.0.6
- old
+ new
@@ -32,12 +32,12 @@
@reading_threads.delete(tid)
@reads -= 1
end
end
- # Runs the given block through the write-synchronization (locks both reading and writing).
- # ===Examples
+ #Runs the given block through the write-synchronization (locks both reading and writing).
+ #===Examples
# lock.wsync do
# #do something within lock.
# end
def wsync
@w_mutex.synchronize do
@@ -63,14 +63,14 @@
end
end
#This module can be included in order to painlessly make a thread-safe multi-reader-single-writer thread-safe copy of a class.
#===Examples
- # class Tsafe::MonHash < ::Hash
- # @@tsafe_mrswlock_w_methods = [:[]=, :clear, :delete, :delete_if, :keep_if, :merge!, :rehash, :reject!, :replace, :select!, :shift, :store, :update, :values_at]
- # @@tsafe_mrswlock_r_methods = [:each, :each_key, :each_pair, :each_value]
- # include Tsafe::Mrswlock::SynModule
- # end
+ # class Tsafe::MonHash < ::Hash
+ # @@tsafe_mrswlock_w_methods = [:[]=, :clear, :delete, :delete_if, :keep_if, :merge!, :rehash, :reject!, :replace, :select!, :shift, :store, :update, :values_at]
+ # @@tsafe_mrswlock_r_methods = [:each, :each_key, :each_pair, :each_value]
+ # include Tsafe::Mrswlock::SynModule
+ # end
module SynModule
def self.included(base)
base.to_s.split("::").inject(Object, :const_get).class_eval do
#Yields the given block within the read-lock.
#===Examples
\ No newline at end of file