CK_ARRAY_PUT_UNIQUE(3)

πŸ’– ck_array_put_unique β€” the manual page, but make it bestie πŸ’–

okay so bestie, you know ck_array_put_unique(3)? yeah. the Concurrency Kit girlies know. it's from libck, you link it with -lck, and it's about slipping a unique pointer into an array. no dupes. no drama. let's get into it ✨


🌸 NAME 🌸

ck_array_put_unique β€” attempt immediate or deferred insertion of a unique pointer into array

like. the whole vibe is: put a pointer in the array, but only if it's not already there. unique queen behavior only πŸ‘‘


🧚 LIBRARY 🧚

Concurrency Kit (libck, -lck)


✨ SYNOPSIS ✨

#include <ck_array.h>

int
ck_array_put_unique(ck_array_t *array, void *pointer);

πŸ’… DESCRIPTION πŸ’…

so the way that ck_array_put_unique(3) works is β€” it attempts to insert the value of pointer into the array that array points to. that's the mission. that's the assignment. 🫢

now, heads up: this function may incur additional memory allocations if not enough memory has been allocated in the array for a new entry. so like, it might go shopping for more memory mid-operation. no cap. πŸ™ˆ

also, the operation is free to apply the operation immediately if there is an opportunity for elimination with a pending (uncommitted) remove operation. so it might just do the thing right now, right on the spot, if the timing is cute. it's giving main character energy fr fr.

and the most important part: the function will not make any modifications if the pointer already exists in the array. nope. not touching it. if you're already in the club, you're already in the club, we're not re-adding you. periodt. πŸ’–


🌈 RETURN VALUES 🌈

  • 1 β€” the pointer already exists in the array. you're already iconic, bestie, nothing to do here πŸ’€
  • 0 β€” the put operation succeeded. slay!! πŸ”₯
  • -1 β€” error, because of internal memory allocation failures. it's giving broke. 😭

πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group, go read them too:

Additional information available at http://concurrencykit.org/ 🌐


okay that's the whole page!! this one is from October 18, 2013 and it lives under the name CK_ARRAY_PUT_UNIQUE(3) β€” mwah, take care of her, she's an icon πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from