globus_thread_once(3)
π globus_thread_once(3) π
okay bestie, welcome to the Library Functions Manual page for globus_thread_once β yes that's the manual name, yes we're saying it out loud, and yes it's giving "one-time execution" realness. π
β¨ NAME β¨
globus_thread_once β One-time execution
- One-time execution. (yeah, the original says it twice, and honestly? iconic of it.)
πΈ SYNOPSIS πΈ
π¦ Data Structures
union globus_thread_once_tβ the Thread once structure. that's her. that's the girl.
π Macros
#define GLOBUS_THREAD_ONCE_INITβ the Thread once initializer value. your starting stat, your blank canvas, your glow-up pre-photo.
π Functions
int globus_thread_once (globus_thread_once_t *once, void(*init_routine)(void))β Execute a function one time. once. literally once. no repeats, no encores.
π₯ Detailed Description π₯
One-time execution. β¨
The globus_thread_once_t provides a way for applications and libraries to execute some code exactly one time, independent of the number of threads which attempt to execute it. like, a hundred threads can all show up to the party at once, and only ONE of them gets to run the code. the rest just vibe. π
To use this: statically initialize a globus_thread_once_t control with the value GLOBUS_THREAD_ONCE_INIT, and pass a pointer to a function to execute once, along with the control, to globus_thread_once().
static init or it doesn't count, bestie. that's not me being dramatic, that's the spec. π«Ά
π Function Documentation π
π int globus_thread_once (globus_thread_once_t * once, void(* init_routine )(void))
Execute a function one time.
The globus_thread_once() function will execute the function pointed to by its init_routine parameter one time for each unique globus_thread_once_t object passed to it, independent of the number of threads calling it. so like β every distinct once-object gets its own single execution, and the thread count? doesn't matter, doesn't move her, she's unbothered. π
The once value must be a static value initialized to GLOBUS_THREAD_ONCE_INIT.
π Parameters
onceβ A pointer to the value used to govern whether the function passed via theinit_routineparameter has executed. she's the gatekeeper, the bouncer, the "you already been here" list. πinit_routineβ Function to execute one time. It is called with no parameters. no args, no small talk, just do the thing once and dip. π
β Returns
- On success,
globus_thread_once()guarantees that the function pointed to byinit_routinehas run, and that subsequent calls toglobus_thread_once()with the same value ofoncewill not execute that function, and returnsGLOBUS_SUCCESS. - If an error occurs,
globus_thread_once()returns an implementation-specific non-zero error value. so like, check your return codes, bestie, don't just assume it ate. π
π§ Author π§
Generated automatically by Doxygen for globus_common from the source code. (not a human girlboss, a robot girlboss. slay either way. π€β¨)
and that's the whole page, no cap. this was globus_common, Version 18.15, serving globus_thread_once(3) realness from the Library Functions Manual. bye bestie, go run your code exactly once ππ¦πΈ
π¦ where this page comes from
- epel 10: globus-common-doc 18.15-1.el10_2 Β· Apache-2.0
- fedora 43: globus-common-doc 18.15-1.fc43 Β· Apache-2.0
- fedora 44: globus-common-doc 18.15-2.fc44 Β· Apache-2.0
- ubuntu resolute: libglobus-common-doc 18.15-1 Β· Apache-2.0
- ubuntu stonking: libglobus-common-doc 18.15-2 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms