QB_LOOP_TIMER_ADD(3)

✨ NAME ✨

qb_loop_timer_add β€” add a timer to the mainloop. that's it, that's the whole vibe πŸŽ€

(this one lives in the libqb Programmer's Manual, just so u know which family reunion we're at πŸ’–)


🌸 SYNOPSIS 🌸

#include <qb/qbloop.h>

int32_t qb_loop_timer_add(
    qb_loop_t                 *l,                 /* pointer to the loop instance */
    enum qb_loop_priority      p,                 /* the priority */
    uint64_t                   nsec_duration,     /* nano-secs in the future to run the dispatch. */
    void                      *data,              /* user data passed into the dispatch function */
    qb_loop_timer_dispatch_fn  dispatch_fn,       /* callback function */
    qb_loop_timer_handle      *timer_handle_out   /* handle to delete the timer if needed. */
);

🫢 PARAMS 🫢

okay so six things, bestie. six. count em πŸ’…

  • l β€” pointer to the loop instance. like, the actual mainloop u want this timer to live in πŸŒ€
  • p β€” the priority. yes it matters, we'll get to it ⭐
  • nsec_duration β€” nano-secs in the future to run the dispatch. nanoseconds!! in the future!! so specific ✨
  • data β€” user data passed into the dispatch function. ur lil payload, ur emotional support pointer πŸŽ€
  • dispatch_fn β€” callback function. the thing that actually runs when the timer goes off πŸ”₯
  • timer_handle_out β€” handle to delete the timer if needed. ur receipt. keep it 🧾

πŸ’œ DESCRIPTION πŸ’œ

so this section is, and i'm being so fr right now, empty in the original page. nothing. blank. a whole heading and then vibes 🫠

not me leaving it here anyway because we keep every section in the same order, periodt. it's giving minimalist. it's giving "the author was busy". iconic either way πŸ‘‘


πŸ¦‹ STRUCTURES πŸ¦‹

here's the priority enum, and yes u pick one of these three when u call the function πŸ‘‡

enum qb_loop_priority {
      QB_LOOP_LOW;
      QB_LOOP_MED;
      QB_LOOP_HIGH;
};
  • QB_LOOP_LOW β€” lowkey priority 🐒
  • QB_LOOP_MED β€” the middle one, medium energy πŸ‡
  • QB_LOOP_HIGH β€” highkey priority, main character energy πŸ‘‘

🌈 RETURN VALUE 🌈

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

so: 0 and we're slaying ✨, negative errno and it's giving tragedy 😭


πŸ’€ NOTE πŸ’€

it is a one-shot job.

read that again bestie. it fires once. one and done. no encore, no round two, no "run it back". if u want it again u gotta add it again fr fr 🎯


πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, go say hi πŸ‘‹


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


okay that's the whole page, u ate it, i'm obsessed 🫢 this was LIBQB, dated 2025-09-16, and it was QB_LOOP_TIMER_ADD(3) the entire time πŸ’– bye bestie, go schedule something ✨

πŸ“¦ where this page comes from