poll: Add missing API docs for polling functions

This commit is contained in:
Bastien Nocera 2018-05-22 18:44:10 +02:00
parent be68bacc94
commit 06c72d54be
3 changed files with 27 additions and 2 deletions

View file

@ -11,6 +11,8 @@ fp_handle_events_timeout
fp_handle_events fp_handle_events
fp_get_next_timeout fp_get_next_timeout
fp_get_pollfds fp_get_pollfds
fp_pollfd_added_cb
fp_pollfd_removed_cb
fp_set_pollfd_notifiers fp_set_pollfd_notifiers
</SECTION> </SECTION>

View file

@ -299,7 +299,11 @@ void fp_img_free(struct fp_img *img);
/** /**
* fp_pollfd: * fp_pollfd:
* @fd: a file descriptor
* @events: Event flags to poll for from `<poll.h>`
* *
* A structure representing a file descriptor and the events to poll
* for, as returned by fp_get_pollfds().
*/ */
struct fp_pollfd { struct fp_pollfd {
int fd; int fd;
@ -311,7 +315,24 @@ int fp_handle_events(void);
size_t fp_get_pollfds(struct fp_pollfd **pollfds); size_t fp_get_pollfds(struct fp_pollfd **pollfds);
int fp_get_next_timeout(struct timeval *tv); int fp_get_next_timeout(struct timeval *tv);
/**
* fp_pollfd_added_cb:
* @fd: the new file descriptor
* @events: events to monitor for, see `<poll.h>` for the possible values
*
* Type definition for a function that will be called when a new
* event source is added. The @events argument is a flag as defined in
* `<poll.h>` such as `POLLIN`, or `POLLOUT`. See fp_set_pollfd_notifiers().
*/
typedef void (*fp_pollfd_added_cb)(int fd, short events); typedef void (*fp_pollfd_added_cb)(int fd, short events);
/**
* fp_pollfd_removed_cb:
* @fd: the file descriptor to stop monitoring
*
* Type definition for a function that will be called when an
* event source is removed. See fp_set_pollfd_notifiers().
*/
typedef void (*fp_pollfd_removed_cb)(int fd); typedef void (*fp_pollfd_removed_cb)(int fd);
void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb, void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb,
fp_pollfd_removed_cb removed_cb); fp_pollfd_removed_cb removed_cb);

View file

@ -340,9 +340,11 @@ API_EXPORTED size_t fp_get_pollfds(struct fp_pollfd **pollfds)
/** /**
* fp_set_pollfd_notifiers: * fp_set_pollfd_notifiers:
* @added_cb: * @added_cb: a #fp_pollfd_added_cb callback or %NULL
* @removed_cb: * @removed_cb: a #fp_pollfd_removed_cb callback or %NULL
* *
* This sets the callback functions to call for every new or removed
* file descriptor used as an event source.
*/ */
API_EXPORTED void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb, API_EXPORTED void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb,
fp_pollfd_removed_cb removed_cb) fp_pollfd_removed_cb removed_cb)