CK_PR_BTS(3)

πŸ’– CK_PR_BTS πŸ’–

okay bestie, welcome to the ck_pr_bts(3) page β€” that's the manual name, and yes it's from Concurrency Kit, the libck girlies' fave. it's giving atomic bit test-and-set, and it ATE. no cap. ✨


🌸 NAME 🌸

ck_pr_bts_ptr, ck_pr_bts_uint, ck_pr_bts_int, ck_pr_bts_64, ck_pr_bts_32, ck_pr_bts_16 β€” atomic bit test-and-set operations πŸ’…

πŸ“š LIBRARY πŸ“š

Concurrency Kit (libck, -lck) β€” literally the whole squad lives here 🫢

✨ SYNOPSIS ✨

#include <ck_pr.h>

bool
ck_pr_bts_ptr(void *target, unsigned int bit_index);

bool
ck_pr_bts_uint(uint *target, unsigned int bit_index);

bool
ck_pr_bts_int(int *target, unsigned int bit_index);

bool
ck_pr_bts_64(uint64_t *target, unsigned int bit_index);

bool
ck_pr_bts_32(uint32_t *target, unsigned int bit_index);

bool
ck_pr_bts_16(uint16_t *target, unsigned int bit_index);

like… pick your fighter. one for every width, and they all do the same slay move πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

so the ck_pr_bts(3) family of functions atomically fetches the value of the bit in target at index bit_index, and then sets that bit to 1. πŸ”₯

that's it. that's the whole vibe. read the bit, flip it to 1, and do it atomically so nobody else can sneak in mid-move. main character energy, fr fr.

πŸŽ€ RETURN VALUES πŸŽ€

this family of functions returns the original value of the bit at offset bit_index that is in the value pointed to by target.

ngl that's the important part β€” you get the before, not the after. it's a glow-up reveal, not a spoiler. πŸ’…

lowkey reminder: the return is the bit as it was before the set, so don't @ me if you expected the new value bestie 😭

🌈 SEE ALSO 🌈

additional information available at http://concurrencykit.org/ 🌐 go click it, bestie, it's iconic


k bye, mwah πŸ’‹ this page was dated April 11, 2013 and it's still serving ck_pr_bts(3) realness to this very day. obsessed. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from