Class: OMQ::Rust::FdWatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/omq/rust/fd_watcher.rb

Defined Under Namespace

Classes: Watch

Class Method Summary collapse

Class Method Details

.unwatch_owner(owner) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/omq/rust/fd_watcher.rb', line 19

def unwatch_owner(owner)
  removed = nil

  mutex.synchronize do
    reset_after_fork
    removed = watchers.values.select { |watch| watch.owner.equal?(owner) }
    removed.each { |watch| watchers.delete(watch.id) }
  end

  removed.each { |watch| close_io(watch.io) }
  wake
end

.watch_loop(fd, owner:, &block) ⇒ Object



14
15
16
# File 'lib/omq/rust/fd_watcher.rb', line 14

def watch_loop(fd, owner:, &block)
  watch(fd, owner: owner, once: false, &block)
end

.watch_once(fd, owner:, &block) ⇒ Object



9
10
11
# File 'lib/omq/rust/fd_watcher.rb', line 9

def watch_once(fd, owner:, &block)
  watch(fd, owner: owner, once: true, &block)
end