Method: LIBUSB::Context#on_pollfd_removed
- Defined in:
- lib/libusb/context.rb
#on_pollfd_removed {|pollfd| ... } ⇒ Object
Register a notification block for file descriptor removals.
This block will be invoked for every removed file descriptor that libusb uses as an event source.
To disable the notification callback, execute on_pollfd_removed without a block.
Note that the removal notifier may be called during #exit (e.g. when it is closing file descriptors that were opened and added to the poll set at #initialize time). If you don’t want this, overwrite the notifier immediately before calling #exit.
495 496 497 498 499 500 501 502 503 |
# File 'lib/libusb/context.rb', line 495 def on_pollfd_removed &block @on_pollfd_removed = if block proc do |fd, _| pollfd = Pollfd.new fd block.call pollfd end end Call.libusb_set_pollfd_notifiers @ctx, @on_pollfd_added, @on_pollfd_removed, nil end |