Class: DirectoryWatcher::EmScanner
- Inherits:
-
EventableScanner
- Object
- EventableScanner
- DirectoryWatcher::EmScanner
- Defined in:
- lib/directory_watcher/em_scanner.rb
Defined Under Namespace
Instance Attribute Summary
Attributes inherited from EventableScanner
#iterations, #maximum_iterations, #watchers
Instance Method Summary (collapse)
-
- (EmScanner) initialize(config)
constructor
A new instance of EmScanner.
- - (Object) start_loop_with_attached_scan_timer
-
- (Object) stop_loop
Called by EventableScanner#stop to stop the loop as part of the shutdown process.
Methods inherited from EventableScanner
#collection_queue, #finished_iterations?, #interval, #join, #on_modified, #on_removed, #on_scan, #pause, #paused?, #resume, #run, #running?, #start, #stop
Methods included from Logable
Constructor Details
- (EmScanner) initialize(config)
A new instance of EmScanner
40 41 42 |
# File 'lib/directory_watcher/em_scanner.rb', line 40 def initialize( config ) super(config) end |
Instance Method Details
- (Object) start_loop_with_attached_scan_timer
47 48 49 50 51 52 53 54 55 |
# File 'lib/directory_watcher/em_scanner.rb', line 47 def start_loop_with_attached_scan_timer return if @loop_thread unless EventMachine.reactor_running? @loop_thread = Thread.new {EventMachine.run} Thread.pass until EventMachine.reactor_running? end @timer = ScanTimer.new(self) end |
- (Object) stop_loop
Called by EventableScanner#stop to stop the loop as part of the shutdown process.
60 61 62 63 64 65 66 67 68 |
# File 'lib/directory_watcher/em_scanner.rb', line 60 def stop_loop if @loop_thread then EventMachine.next_tick do EventMachine.stop_event_loop end @loop_thread.kill @loop_thread = nil end end |