GLib.Source.prototype.add_poll

function add_poll(fd: GLib.PollFD): void {
    // Gjs wrapper for g_source_add_poll()
}
  

Adds a file descriptor to the set of file descriptors polled for this source. This is usually combined with GLib.Source.new to add an event source. The event source's check function will typically test the @revents field in the GLib.PollFD struct and return true if events need to be processed.

This API is only intended to be used by implementations of GLib.Source. Do not call this API on a GLib.Source that you did not create.

Using this API forces the linear scanning of event sources on each main loop iteration. Newly-written event sources should try to use GLib.Source.add_unix_fd instead of this API.

fd

a GLib.PollFD structure holding information about a file descriptor to watch.