# File lib/puppet/external/lock.rb, line 43 43: def lock_shared 44: if Thread.list.size == 1 45: flock(LOCK_SH) 46: else 47: # ugly hack because waiting for a lock in a Ruby thread blocks the 48: # process 49: period = 0.001 50: until flock(LOCK_SH|LOCK_NB) 51: sleep period 52: period *= 2 if period < 1 53: end 54: end 55: 56: yield self 57: ensure 58: Thread.exclusive {flock(LOCK_UN) if $reader_count[self.stat.ino] == 1} 59: ## for solaris, no need to unlock here--closing does it 60: ## but this has no effect on the bug 61: end