CK_PR_STORE(3)

πŸ’Ύ ck_pr_store(3) β€” atomic volatile store operations πŸ’Ύ

okay bestie sit DOWN because we're talking about ck_pr_store(3) from the Concurrency Kit and honestly? she's giving quiet luxury. no drama, no return value, just vibes and perfect memory ordering. πŸŽ€

πŸ“š LIBRARY πŸ“š

Concurrency Kit β€” you link her with -lck and then she's yours. πŸ’…


✨ SYNOPSIS ✨

first things first, you gotta summon the header:

#include <ck_pr.h>

and then, pick your fighter. nine of them. all iconic, all tiny:

void
ck_pr_store_ptr(void *target, void *value);

void
ck_pr_store_double(double *target, double value);

void
ck_pr_store_uint(unsigned int *target, unsigned int value);

void
ck_pr_store_int(int *target, int value);

void
ck_pr_store_char(char *target, char value);

void
ck_pr_store_64(uint64_t *target, uint64_t value);

void
ck_pr_store_32(uint32_t *target, uint32_t value);

void
ck_pr_store_16(uint16_t *target, uint16_t value);

void
ck_pr_store_8(uint8_t *target, uint8_t value);

one for every size of your little heart's content 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, and it's actually really good tea:

the whole ck_pr_store(3) family does exactly one thing β€” it atomically stores the value you pass in as value into the memory location that target points at. that's it. that's the whole job. she doesn't overcomplicate, she doesn't do side quests, she just puts the thing where you asked her to put the thing. πŸ’–

and the way that she ALWAYS serves as an implicit compiler barrier?? no cap. the compiler is not gonna reorder her, she's not susceptible to compiler re-ordering, periodt. your writes stay exactly where you wrote them. main character energy in the memory model. πŸ”₯

ngl this is the one you reach for when you need a write that the compiler respects and the hardware won't shuffle behind your back. she's the reliable bestie. 🌸

πŸ‘‘ RETURN VALUES πŸ‘‘

the way that she returns... nothing. πŸ’€

fr fr, this family of functions has no return value. she does the thing and she leaves. no receipt, no follow-up text, no notes. just a clean store and a goodbye. 🧚


🌈 SEE ALSO 🌈

your recommended reading list, bestie β€” go stan all of them:

and if you want even more lore, the extra info lives at http://concurrencykit.org/ 🌐


okay that's the whole page!! go write some atomic stores and be amazing πŸ’œ

🌸 this little beauty dropped on April 15, 2013, and she's part of the Concurrency Kit β€” it's ck_pr_store(3), and yes, she slayed. πŸŽ€βœ¨

πŸ“¦ where this page comes from