Class | N::SafeHashDelegator |
In: |
lib/glue/hash.rb
|
Parent: | Hash |
A thread-safe hash. We use a sync object instead of a mutex, because it is re-entrant. An exclusive lock is needed when writing, a shared lock IS NEEDED when reading
Design: This class uses the delegator pattern. However we dont use rubys delegation facilities, they are more general and powerfull than we need here (and slower). Instead a custom (but simple) solution is used.
Example:
hash = SafeHashDelegator.new(Hash.new) hash = SafeHashDelegator.new(Hash.new)
delegate | [RW] |