CK_PR_STALL(3)

πŸ’– ck_pr_stall β€” the busy-wait bestie πŸ’–

okay so bestie, welcome to ck_pr_stall(3) β€” she's tiny, she's iconic, and she lives in the Concurrency Kit (that's libck, link her with -lck). no cap, this is the whole page. let's go 🫢


✨ LIBRARY ✨

Concurrency Kit β€” aka libck, and you link it with -lck. that's the whole vibe. πŸŽ€


🌸 SYNOPSIS 🌸

#include <ck_pr.h>

void
ck_pr_stall(void);

like... that's it. no arguments, no return value, just vibes and a function call. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so listen. the ck_pr_stall(3) function is the girl you call when you're stuck in the retry paths of busy-wait loops. she belongs inside the loop, doing her little spin, not outside wondering what's happening.

and the way that she's lowkey doing two jobs at once?? first: she acts as a compiler barrier β€” which means the compiler can't just waltz in and reorder everything around her, periodt. second: on some architectures she emits cycle-saving instructions, which is highkey a slay because your CPU gets to chill instead of burning cycles for no reason. 🌈

so basically: busy-waiting? fine. busy-waiting without her? not the move, bestie. 😭


πŸŽ€ EXAMPLE πŸŽ€

here's her in her natural habitat, doing main character energy inside a while loop:

#include <ck_pr.h>

static int ready = 0;

void
function(void)
{

        /* Busy-wait until ready is non-zero. */
        while (ck_pr_load_int(&ready) == 0)
                ck_pr_stall();

        return;
}

see how she sits right there in the retry path?? that's the assignment. she's not the star of the loop, she's the supporting icon making the loop bearable. ✨


πŸ‘‘ SEE ALSO πŸ‘‘

her whole friend group, fr fr β€” go read these too:

and if you want even more lore, there's additional information available at http://concurrencykit.org/ πŸŒπŸ’œ


no cap, that's genuinely every single thing on the page. every flag, every reference, every line of code β€” all accounted for. nothing skipped, nothing invented. 🧚

and that's the whole page, bestie!! πŸ₯³ this one's dated April 7, 2013, and it's ck_pr_stall(3) β€” mwah, love her, obsessed, no notes. πŸ’–βœ¨πŸŒΈπŸ¦‹πŸŽ€πŸ’…πŸ«Ά

πŸ“¦ where this page comes from