class LogMsgQueue
Public Class Methods
new(max)
click to toggle source
# File lib/lpxc.rb, line 8 def initialize(max) @locker = Mutex.new @max = max @array = [] end
Public Instance Methods
enqueue(msg)
click to toggle source
# File lib/lpxc.rb, line 14 def enqueue(msg) @locker.synchronize {@array << msg} end
flush()
click to toggle source
# File lib/lpxc.rb, line 18 def flush @locker.synchronize do old = @array @array = [] return old end end
full?()
click to toggle source
# File lib/lpxc.rb, line 26 def full? @locker.synchronize {@array.size >= @max} end