QB_LOOP_SIGNAL_ADD(3)

πŸ’– QB_LOOP_SIGNAL_ADD β€” bestie edition πŸ’–

okay so this is a page from the libqb Programmer's Manual, and today's main character is qb_loop_signal_add(3). yes, it's a libqb thing. yes, it's gonna be fun. come with me 🫢


✨ NAME ✨

qb_loop_signal_add β€” Add a signal job.

like. that's the whole vibe. it adds a signal job. iconic behaviour honestly 🌸


✨ SYNOPSIS ✨

#include <qb/qbloop.h>

int32_t qb_loop_signal_add(
    qb_loop_t                  *l,            /* pointer to the loop instance */
    enum qb_loop_priority       p,            /* the priority */
    int32_t                     sig,          /* (SIGHUP or SIGINT) etc .... */
    void                       *data,         /* user data passed into the dispatch function */
    qb_loop_signal_dispatch_fn  dispatch_fn,  /* callback function */
    qb_loop_signal_handle      *handle        /* (out) a reference to the signal job */
);

no cap, that's the exact signature, copy it character for character and don't be cute with it πŸ’…


✨ PARAMS ✨

the whole squad of arguments, one by one:

  • l β€” pointer to the loop instance. it's your loop, bestie, you gotta bring it.
  • p β€” the priority. that's the enum qb_loop_priority situation (more on that below πŸ‘€).
  • sig β€” the signal. (SIGHUP or SIGINT) etc .... so like, those ones. or others. the etc is doing a lot of heavy lifting there but we respect it.
  • data β€” user data passed into the dispatch function. it's your lil parcel of vibes that gets handed to the callback πŸŽ€
  • dispatch_fn β€” callback function. the thing that actually goes off.
  • handle β€” (out) a reference to the signal job. it's an out-param, so it's giving back to you, not taking. so generous of it 🫢

✨ DESCRIPTION ✨

Get a callback on this signal (not in the context of the signal).

that "not in the context of the signal" part is lowkey the whole point, so don't skim it. the callback doesn't run inside the signal handler's context β€” it gets dispatched through the loop instead. slay, safe, we love to see it ✨


✨ STRUCTURES ✨

here's the priority enum, verbatim, no edits:

enum qb_loop_priority {
      QB_LOOP_LOW;
      QB_LOOP_MED;
      QB_LOOP_HIGH;
};

three tiers. low, med, high. pick your fighter πŸ”₯


✨ RETURN VALUE ✨

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

so: 0? you ate. -errno? not the vibe. check it, bestie 😭


✨ SEE ALSO ✨

the whole friend group, all of them, no one left behind:


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


fr fr, that's the whole page. every flag, every param, every reference, all present and accounted for. nothing skipped, nothing invented πŸ’œ

okay bye bestie, go handle those signals responsibly. this page is from libqb, dated 2025-09-16, and it's the QB_LOOP_SIGNAL_ADD(3) moment. periodt πŸ’…πŸŽ€πŸŒˆ

πŸ“¦ where this page comes from