QB_LOOP_POLL_ADD(3)

✨ QB_LOOP_POLL_ADD ✨

okay so bestie, we're in the libqb Programmer's Manual and this page is literally called qb_loop_poll_add πŸ’… it lives in section 3 (that's the library-functions girlies, iykyk) so go ahead and pull up a chair πŸŽ€


🌸 NAME 🌸

qb_loop_poll_add β€” add a poll job to the mainloop. that's it, that's the whole vibe πŸ¦‹


πŸ’– SYNOPSIS πŸ’–

#include <qb/qbloop.h>

int32_t qb_loop_poll_add(
    qb_loop_t                *l,            /* pointer to the loop instance */
    enum qb_loop_priority     p,            /* the priority */
    int32_t                   fd,           /* file descriptor. */
    int32_t                   events,       /* (POLLIN|POLLOUT) etc .... */
    void                     *data,         /* user data passed into the dispatch function */
    qb_loop_poll_dispatch_fn  dispatch_fn   /* callback function */
);

no cap, that's the whole signature πŸ‘‘ include the header, call the function, slay.


🧚 PARAMS 🧚

so here's who's showing up to the function call, one by one:

  • l β€” pointer to the loop instance. your main character loop, fr fr.
  • p β€” the priority. lowkey, med, or highkey. (see STRUCTURES below πŸ‘‡)
  • fd β€” file descriptor.
  • events β€” (POLLIN|POLLOUT) etc .... yes, you can or them together, that's the whole point 🫢
  • data β€” user data passed into the dispatch function. your little gift bag for the callback πŸŽ€
  • dispatch_fn β€” callback function. the one who actually does the thing when the poll fires πŸ’…

🌈 DESCRIPTION 🌈

literally what it says on the tin, bestie β€” you're handing the mainloop a poll job. ✨


πŸ¦‹ STRUCTURES πŸ¦‹

the priority enum, in all her glory:

enum qb_loop_priority {
      QB_LOOP_LOW;
      QB_LOOP_MED;
      QB_LOOP_HIGH;
};

three tiers, three moods, pick your fighter πŸ’œ


⭐ RETURN VALUE ⭐

status (0 == ok, -errno == failure)

so like, 0 is the good ending, and a negative errno is the "not me crying in the group chat" ending 😭


πŸ”₯ NOTE πŸ”₯

it is a re-occurring job. so don't come crying to me when it fires again, bestie β€” that's the assignment 🫢

πŸ’€ SEE ALSO πŸ’€

the whole friend group, go read them too:


Copyright (C) 2010-2020 Red Hat, Inc.


okay that's the page!! πŸŽ€ this was LIBQB, dated 2025-09-16, and the manual page is QB_LOOP_POLL_ADD(3) β€” go forth and poll responsibly, bestie, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from