Monitor
See log4r/MDC.rb
# File lib/log4r/MDC.rb, line 19 19: def self.check_thread_instance() 20: # need to interlock here, so that if 21: # another thread is entering this section 22: # of code before the main thread does, 23: # then the main thread copy of the MDC 24: # is setup before then attempting to clone 25: # it off 26: if ( Thread.current[MDCNAME] == nil ) then 27: $globalMDCLock.synchronize do 28: if ( Thread.main[MDCNAME] == nil ) then 29: Thread.main[MDCNAME] = Hash.new 30: end 31: if ( Thread.current != Thread.main ) then 32: Thread.current[MDCNAME] = Hash.new 33: Thread.main[MDCNAME].each{ |k,v| Thread.current[MDCNAME][k] = v } 34: end 35: end 36: end 37: end
# File lib/log4r/MDC.rb, line 39 39: def self.get( a_key ) 40: self.check_thread_instance() 41: Thread.current[MDCNAME].fetch(a_key, ""); 42: end
# File lib/log4r/MDC.rb, line 44 44: def self.get_context() 45: self.check_thread_instance() 46: return Thread.current[MDCNAME].clone 47: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.