![]() |
wget2 2.3.0
|
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) |
This is a wrapper around Gnulib's glthread functionality.
It currently supports Posix threads (pthreads), GNU Pth threads, Solaris threads and Windows threads.
| int wget_thread_mutex_init | ( | wget_thread_mutex * | mutex | ) |
| [in,out] | mutex | The mutex to initialize |
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 | ) |
| [in,out] | mutex | The mutex to destroy |
Free's the mutex and it's resources.
After calling this function, the mutex cannot be used any more.
| void wget_thread_mutex_lock | ( | wget_thread_mutex | mutex | ) |
| [in] | 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 | ) |
| [in] | mutex | The mutex to be unlocked |
Unlocks the mutex.
| int wget_thread_cond_init | ( | wget_thread_cond * | cond | ) |
| [in,out] | cond | The conditional to initialize |
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 | ) |
| [in,out] | cond | The conditional to destroy |
Free's the conditional cond and it's resources.
After calling this function, cond cannot be used any more.
| int wget_thread_cond_signal | ( | wget_thread_cond | cond | ) |
| [in] | cond | The conditional to signal a condition |
Wakes up one (random) thread that waits on the conditional.
| int wget_thread_cond_wait | ( | wget_thread_cond | cond, |
| wget_thread_mutex | mutex, | ||
| long long | ms ) |
| [in] | cond | The conditional to wait for |
| [in] | mutex | The mutex needed for thread-safety |
| [in] | ms | The wait timeout in milliseconds |
Waits for a condition with a max. timeout of ms milliseconds.
To wait forever use a timeout lower or equal then 0.
| int wget_thread_start | ( | wget_thread * | thread, |
| void * | start_routine (*)(void *), | ||
| void * | arg, | ||
| WGET_GCC_UNUSED int | flags ) |
| [out] | thread | The thread variable to be initialized |
| [in] | start_routine | The thread function to start |
| [in] | arg | The argument given to start_routine |
| [in] | flags | Currently unused |
Start start_routine as own thread with argument arg.
| int wget_thread_cancel | ( | WGET_GCC_UNUSED wget_thread | thread | ) |
| [in] | thread | Thread to cancel |
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 ) |
| [in] | thread | Thread to send the signal to |
| [in] | sig | Signal to send |
Currently a no-op function, since it's not portable.
| int wget_thread_join | ( | wget_thread * | thread | ) |
| [in] | thread | Thread to wait for |
Wait until the thread has been stopped.
This function just waits - to stop a thread you have take your own measurements.
| wget_thread_id wget_thread_self | ( | void | ) |
| bool wget_thread_support | ( | void | ) |