QB_ATOMIC_INT_ADD(3)
π qb_atomic_int_add β bestie edition π
okay so real quick, this is qb_atomic_int_add(3) from the libqb Programmer's Manual, section 3, and honestly? it's giving "tiny function, big responsibilities." let's get into it π«Ά
β¨ NAME β¨
qb_atomic_int_add β atomically adds val to the integer pointed to by atomic.
like, atomically atomically. no cap. π§
β¨ SYNOPSIS β¨
#include <qb/qbatomic.h>
void qb_atomic_int_add(
volatile int32_t QB_GNUC_MAY_ALIAS *atomic, /* a pointer to an integer */
int32_t val /* the value to add to *atomic */
);
bestie look at that signature. two args. no return value. it just does the thing. main character energy fr fr π
β¨ PARAMS β¨
atomicβ a pointer to an integer. that's the lil guy getting the addition done to it πvalβ the value to add to*atomic. yes it goes into the pointer target, not the pointer itself. iykyk π
β¨ DESCRIPTION β¨
so it adds val to the integer that atomic points at, and it does it atomically β which means nobody can sneak in halfway and catch it mid-addition. no half-finished math, no cursed in-between state. gorgeous. flawless. iconic. πΈ
also it acts as a memory barrier π§±β¨
that's the whole description. short king behavior but like, in a good way.
β¨ SEE ALSO β¨
the whole friend group π«Ά go read these too:
qb_atomic_int_set(3)qb_atomic_int_compare_and_exchange(3)qb_atomic_int_get(3)qb_atomic_init(3)qb_atomic_pointer_get(3)qb_atomic_int_exchange_and_add(3)qb_atomic_pointer_compare_and_exchange(3)qb_atomic_pointer_set(3)
β¨ COPYRIGHT β¨
Copyright (C) 2003 Sebastian Wilhelmi
and that's the whole page, bestie!! π it's LIBQB, it's dated 2025-09-16, and it will forever be known as QB_ATOMIC_INT_ADD(3). mwah. go add some integers. atomically. π
π
π¦ 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