QB_LOOP_JOB_ADD(3)
π QB_LOOP_JOB_ADD π
okay bestie, so this is a page from the libqb Programmer's Manual and we're about to make your mainloop do a little task for you. it's giving "hey can you run this for me real quick" energy and honestly? iconic. π
β¨ NAME β¨
qb_loop_job_add β Add a job to the mainloop. π«Ά
π SYNOPSIS π
#include <qb/qbloop.h>
int32_t qb_loop_job_add(
qb_loop_t *l, /* pointer to the loop instance */
enum qb_loop_priority p, /* the priority */
void *data, /* user data passed into the dispatch function */
qb_loop_job_dispatch_fn dispatch_fn /* callback function */
);
π¦ PARAMS π¦
lβ pointer to the loop instance π« (like, which loop are we doing this to, bestie)pβ the priority β¨ (yes you get to pick, we'll get to that)dataβ user data passed into the dispatch function π (your little care package that gets handed straight to the callback)dispatch_fnβ callback function π (the thing that actually gets run)
π DESCRIPTION π
This is run in the next cycle of the loop. no cap. you hand it the job, the loop picks it up on the very next pass around, and that's the whole deal. lowkey elegant. π
π§ STRUCTURES π§
enum qb_loop_priority {
QB_LOOP_LOW;
QB_LOOP_MED;
QB_LOOP_HIGH;
};
your three priority vibes, from chill to main character. πΈ
β RETURN VALUE β
status (0 == ok, -errno == failure)
so likeβ¦ zero means slay, negative errno means it did NOT eat. π
π₯ NOTE π₯
it is a one-shot job. π¨
bestie hear me out β ONE. SHOT. it runs once and it's done. do not expect it to come back. it is not coming back. if you wanted a recurring thing, that is a different function and a different conversation. π
π SEE ALSO π
qb_loop_job_del(3)qb_loop_run(3)qb_loop_create(3)qb_loop_stop(3)qb_loop_poll_low_fds_event_set(3)qb_loop_signal_del(3)qb_loop_signal_add(3)qb_loop_poll_del(3)qb_loop_destroy(3)qb_loop_timer_expire_time_remaining(3)qb_loop_poll_mod(3)qb_loop_signal_mod(3)qb_loop_timer_del(3)qb_loop_timer_add(3)qb_loop_timer_is_running(3)qb_loop_timer_expire_time_get(3)qb_loop_poll_add(3)
the whole friend group, fr fr. go read them all, iykyk. πβ¨
π COPYRIGHT π
Copyright (C) 2010-2020 Red Hat, Inc.
and that's the tea, bestie π β this lil page came from libqb, dated 2025-09-16, and you just read the whole thing like the queen you are. periodt. ππ
π¦ where this page comes from
- fedora 44: libqb-devel 2.0.9-2.fc44 Β· LGPL-2.1-or-later
- fedora 44: libqb-devel 2.0.9-2.fc44 Β· LGPL-2.1-or-later
- ubuntu resolute: libqb-dev 2.0.9-1ubuntu1 Β· LGPL-2.1-or-later
- ubuntu stonking: libqb-dev 2.0.9-1ubuntu1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms