class Qwik::SiteMonitor
Constants
- MAX_LISTENER
Public Class Methods
new(config, site)
click to toggle source
# File vendor/qwik/lib/qwik/site-monitor.rb, line 20 def initialize(config, site) @config = config @site = site @buf = [] @buf.extend(MonitorMixin) @empty_cond = @buf.new_cond @listener = [] end
Public Instance Methods
listen(action) { |ev| ... }
click to toggle source
# File vendor/qwik/lib/qwik/site-monitor.rb, line 38 def listen(action) len = @listener.length # if MAX_LISTENER < len # return # end @listener << action index = @buf.length loop { @buf.synchronize { @empty_cond.wait_while { @buf[index].nil? } ev = @buf[index] index += 1 yield(ev) } } end
shout(event)
click to toggle source
# File vendor/qwik/lib/qwik/site-monitor.rb, line 31 def shout(event) @buf.synchronize { @buf.push(event) @empty_cond.broadcast } end