Module: DTAS::Watchable

Included in:
Source::SplitFX
Defined in:
lib/dtas/watchable.rb

Overview

used to restart DTAS::Source::SplitFX processing in dtas-player if the YAML file is edited

Defined Under Namespace

Classes: InotifyReadableIter

Instance Method Summary collapse

Instance Method Details

#watch_begin(blk) ⇒ Object



41
42
43
44
45
# File 'lib/dtas/watchable.rb', line 41

def watch_begin(blk)
  @ino = InotifyReadableIter.new
  @ino.watch_file(@infile, blk)
  @ino
end

#watch_end(srv) ⇒ Object

Closing the inotify descriptor (instead of using inotify_rm_watch) is cleaner because it avoids EINVAL on race conditions in case a directory is deleted: lkml.org/lkml/2007/7/9/3



50
51
52
53
# File 'lib/dtas/watchable.rb', line 50

def watch_end(srv)
  srv.wait_ctl(@ino, :delete)
  @ino = @ino.close
end