Q_INIT(3)

πŸ’– q_init(3) β€” the Librecast Programmer's Manual, but make it cute πŸ’–

okay bestie, pull up a chair πŸŽ€ this is the Q_INIT(3) page from the Librecast Programmer's Manual, and it's literally the origin story of every queue you're ever gonna make. two functions. one vibe. let's go ✨


🌸 NAME 🌸

q_init, q_free β€” initialize and free queue

like, one of them sets your queue up for its main character era, and the other one sends it home. that's it. that's the whole job 🫢


πŸ“š LIBRARY πŸ“š

Librecast library (liblibrecast, -llibrecast)


✨ SYNOPSIS ✨

#include <librecast/q.h>

int q_init(q_t *q);
int q_free(q_t *q);

Compile and link with -llibrecast.

not me reminding you to actually link the library πŸ’€ if you forget -llibrecast it's giving "why is my linker crying" energy

πŸ¦‹ DESCRIPTION πŸ¦‹

The q_init() function initializes smolq queue q. tiny queue, huge potential, obsessed πŸ₯Ή

and then… you will be so surprised to learn 🌈 that q_free() is the corresponding function to free a queue so initialized. like yes bestie, it does exactly what it says on the tin. the way that freeing is just the opposite of initializing… iconic. periodt πŸ’…


πŸŽ€ RETURN VALUE πŸŽ€

These functions return zero on success. On error, -1 is returned and errno is set to indicate the error.

so like, 0 = slay, -1 = check errno, no cap πŸ”₯


πŸ’€ ERRORS πŸ’€

q_init() may fail when initializing the queue semaphore. q_free() may fail when destroying the queue semaphore. See sem_init(3) and sem_destroy(3) for the relevant error codes.

real talk: both of the possible fail points here are semaphore drama, so if something's off, go read those two pages fr fr πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

go read the whole squad, they're all connected iykyk ⭐


okay that's the page!! this one's from the LIBRECAST crew, dated 2023-07-23, and it lives at section 3 of the manual (the Q_INIT(3) one, you already knew that πŸ’œ). go init a queue, bestie, you got this 🫢✨

πŸ“¦ where this page comes from