Module | RubyRunBufferMgr__ |
In: |
lib/rubyrun/rubyrun_buffer_mgr__.rb
|
Push data into the current buffer Primary or secondary buffer may be used but it is transparent to the caller
# File lib/rubyrun/rubyrun_buffer_mgr__.rb, line 30 30: def push_current_buffer(metrics) 31: $rubyrun_lock.synchronize { 32: ($rubyrun_current_buffer == 1 ? $rubyrun_prime_buffer : $rubyrun_alt_buffer) << metrics 33: } 34: end
Return the current buffer and swap it with the other one This method is invoked by the consumer of the data in the buffer
# File lib/rubyrun/rubyrun_buffer_mgr__.rb, line 38 38: def return_and_switch_buffer() 39: $rubyrun_lock.synchronize { 40: if ($rubyrun_current_buffer == 1) 41: $rubyrun_current_buffer == 2 42: $rubyrun_prime_buffer 43: else 44: $rubyrun_current_buffer == 1 45: $rubyrun_alt_buffer 46: end 47: } 48: end