globus_thread_once(3)

πŸ“¦
version 18.15 Β· 6 versions
, in epel 10, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

πŸ’– 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 the init_routine parameter 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 by init_routine has run, and that subsequent calls to globus_thread_once() with the same value of once will not execute that function, and returns GLOBUS_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 πŸ’–πŸ¦‹πŸŒΈ