CK_PR_LOAD(3)

πŸ’– ck_pr_load(3) β€” the manual page, but make it cute πŸ’–

okay bestie, gather round 🫢 this is ck_pr_load(3) from the Concurrency Kit library β€” the one that's basically the "grab me that value, and do it safely" family of functions. Nine little legends. Let's go. ✨


🌸 LIBRARY 🌸

Concurrency Kit (that's libck, link it with -lck) β€” yeah, that's the one. πŸ’…


✨ SYNOPSIS ✨

#include <ck_pr.h>

void *
ck_pr_load_ptr(const void *target);

double
ck_pr_load_double(const double *target);

unsigned int
ck_pr_load_uint(const unsigned int *target);

int
ck_pr_load_int(const int *target);

char
ck_pr_load_char(const char *target);

uint64_t
ck_pr_load_64(const uint64_t *target);

uint32_t
ck_pr_load_32(const uint32_t *target);

uint16_t
ck_pr_load_16(const uint16_t *target);

uint8_t
ck_pr_load_8(const uint8_t *target);

nine functions, nine vibes, one header, zero excuses 🧚


πŸ’« DESCRIPTION πŸ’«

So here's the tea, bestie. β˜• The whole ck_pr_load(3) squad does one thing and does it flawlessly: it atomically loads the value that target is pointing at, and hands it right back to you. Like, you ask for the value, the value shows up, no drama, no weird in-between states, no "wait was that the old value or the new one". 🌈

And here's the part that makes it actually iconic β€” every single one of these functions always serves as an implicit compiler barrier, and it is not susceptible to re-ordering by the compiler. Not me letting the compiler shuffle my loads around... couldn't be these functions. 😀 The compiler is gonna respect the order of operations, periodt. πŸ‘‘


πŸŽ€ RETURN VALUES πŸŽ€

Every function in this family returns the value contained in the location pointed to by the first argument. That's it. That's the whole reveal. You point at a thing, you get the thing. πŸ“


πŸ¦‹ SEE ALSO πŸ¦‹

the whole extended friend group, fr fr πŸ’œ

And if you want even more lore, additional information is available at http://concurrencykit.org/ 🌐 β€” go read, bestie, it's giving documentation main character energy. πŸ“šβœ¨


okay that's the whole page, you understood all of it, I'm so proud of you πŸ’–

signing off from the very bottom of the page: this was ck_pr_load(3), dated April 15, 2013 πŸŽ‚ β€” yes she's an elder but she still slays, and she comes to you courtesy of Concurrency Kit. take care of her, she's atomic. πŸ’…πŸ«ΆπŸŒΈ

πŸ“¦ where this page comes from