Method: LIBUSB::Context#on_pollfd_added
- Defined in:
- lib/libusb/context.rb
#on_pollfd_added {|pollfd| ... } ⇒ Object
Register a notification block for file descriptor additions.
This block will be invoked for every new file descriptor that libusb uses as an event source.
To disable the notification callback, execute on_pollfd_added without a block.
Note that file descriptors may have been added even before you register these notifiers (e.g. at #initialize time).
472 473 474 475 476 477 478 479 480 |
# File 'lib/libusb/context.rb', line 472 def on_pollfd_added &block @on_pollfd_added = if block proc do |fd, events, _| pollfd = Pollfd.new fd, events block.call pollfd end end Call.libusb_set_pollfd_notifiers @ctx, @on_pollfd_added, @on_pollfd_removed, nil end |