libwget-thread(3)
π NAME π
libwget-thread β bestie, this is the implementation of multi-threading basic functionality π β¨
(it lives in the libwget-thread(3) manual page, iykyk π)
πΈ SYNOPSIS πΈ
β¨ Data Structures β¨
struct wget_thread_st
struct wget_thread_mutex_st
struct wget_thread_cond_st
π¦ Functions π¦
int wget_thread_mutex_init (wget_thread_mutex *mutex)
int wget_thread_mutex_destroy (wget_thread_mutex *mutex)
void wget_thread_mutex_lock (wget_thread_mutex mutex)
void wget_thread_mutex_unlock (wget_thread_mutex mutex)
int wget_thread_cond_init (wget_thread_cond *cond)
int wget_thread_cond_destroy (wget_thread_cond *cond)
int wget_thread_cond_signal (wget_thread_cond cond)
int wget_thread_cond_wait (wget_thread_cond cond, wget_thread_mutex
mutex, long long ms)
int wget_thread_start (wget_thread *thread, void *(*start_routine)(void
*), void *arg, WGET_GCC_UNUSED int flags)
int wget_thread_cancel (WGET_GCC_UNUSED wget_thread thread)
int wget_thread_kill (WGET_GCC_UNUSED wget_thread thread,
WGET_GCC_UNUSED int sig)
int wget_thread_join (wget_thread *thread)
wget_thread_id wget_thread_self (void)
bool wget_thread_support (void)
π Detailed Description π
Okay so the tea: this is a wrapper around Gnulib's glthread functionality. π«Ά
It currently supports Posix threads (pthreads), GNU Pth threads, Solaris threads and Windows threads. She's versatile like that. β¨
π Function Documentation π
int wget_thread_mutex_init (wget_thread_mutex * mutex)
Parameters
- mutex β the mutex to initialize
Returns
0on success, non-zero on failure
Initializes the mutex. π
After usage, a call to wget_thread_mutex_destroy() frees the allocated resources.
int wget_thread_mutex_destroy (wget_thread_mutex * mutex)
Parameters
- mutex β the mutex to destroy
Returns
0on success, non-zero on failure
Free's the mutex and it's resources. π
After calling this function, the mutex cannot be used any more. Like, at all. Gone. Bye. π«Ά
void wget_thread_mutex_lock (wget_thread_mutex mutex)
Parameters
- mutex β the mutex to be locked
Creates a lock on the mutex. π
To unlock the mutex, call wget_thread_mutex_unlock().
void wget_thread_mutex_unlock (wget_thread_mutex mutex)
Parameters
- mutex β the mutex to be unlocked
Unlocks the mutex. Freedom. π¦
int wget_thread_cond_init (wget_thread_cond * cond)
Parameters
- cond β the conditional to initialize
Returns
0on success, non-zero on failure
Initializes the conditional cond. β¨
After usage, a call to wget_thread_cond_destroy() frees the allocated resources.
int wget_thread_cond_destroy (wget_thread_cond * cond)
Parameters
- cond β the conditional to destroy
Returns
0on success, non-zero on failure
Free's the conditional cond and it's resources. π
After calling this function, cond cannot be used any more. No cap.
int wget_thread_cond_signal (wget_thread_cond cond)
Parameters
- cond β the conditional to signal a condition
Returns
0on success, non-zero on failure
Wakes up one (random) thread that waits on the conditional. Not me picking favourites, it literally says random. π
int wget_thread_cond_wait (wget_thread_cond cond, wget_thread_mutex mutex, long long ms)
Parameters
- cond β the conditional to wait for
- mutex β the mutex needed for thread-safety
- ms β the wait timeout in milliseconds
Returns
0on success, non-zero on failure
Waits for a condition with a max. timeout of ms milliseconds. β³
To wait forever use a timeout lower or equal then 0. (Yes, forever-forever. Main character commitment.) π
int wget_thread_start (wget_thread * thread, void *(* start_routine )(void *), void * arg, WGET_GCC_UNUSED int flags)
Parameters
- thread β the thread variable to be initialized
- start_routine β the thread function to start
- arg β the argument given to start_routine
- flags β currently unused
Returns
0on success, non-zero on failure
Start start_routine as own thread with argument arg. Slay, she's born. π£β¨
int wget_thread_cancel (WGET_GCC_UNUSED wget_thread thread)
Parameters
- thread β thread to cancel
Returns
0on success, non-zero on failure
Currently a no-op function, since it's not portable. π
int wget_thread_kill (WGET_GCC_UNUSED wget_thread thread, WGET_GCC_UNUSED int sig)
Parameters
- thread β thread to send the signal to
- sig β signal to send
Returns
0on success, non-zero on failure
Currently a no-op function, since it's not portable. π (twins with the one above, fr fr)
int wget_thread_join (wget_thread * thread)
Parameters
- thread β thread to wait for
Returns
0on success, non-zero on failure
Wait until the thread has been stopped. π«Ά
This function just waits β to stop a thread you have take your own measurements. Like, she's not gonna do it for you, bestie. π
wget_thread_id wget_thread_self (void )
Returns
- the thread id of the caller
bool wget_thread_support (void )
Returns
- whether
libwgetsupports multi-threading on this platform or not
Vibe check for your platform. π
π Author π
Generated automatically by Doxygen for wget2 from the source code.
And that's the whole page, bestie!! πβ¨ No notes, she ate. This was libwget-thread(3) from wget2, Version 2.3.0 β go forth and thread responsibly, ily, mwah π«Άππ¦
π¦ where this page comes from
- fedora 44: wget2-devel 2.3.0-1.fc44
- fedora 44: wget2-devel 2.3.0-1.fc44
- fedora 44: wget2-devel 2.3.0-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 44: wget2-devel 2.3.0-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms