class Listen::Adapter::Polling
file IO than the other implementations.
uses the most CPU processing power and has higher
has no dependencies. This is the adapter that
Polling Adapter that works cross-platform and
def _configure(_, &callback)
def _configure(_, &callback) @polling_callbacks ||= [] @polling_callbacks << callback end
def _process_event(dir, _)
def _process_event(dir, _) _queue_change(:dir, dir, '.', recursive: true) end
def _run
def _run loop do start = MonotonicTime.now @polling_callbacks.each do |callback| callback.call(nil) if (nap_time = options.latency - (MonotonicTime.now - start)) > 0 # TODO: warn if nap_time is negative (polling too slow) sleep(nap_time) end end end end