logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

libwget-thread - Implementation of multi-threading basic functionality

Author

       Generated automatically by Doxygen for wget2 from the source code.

wget2                                             Version 2.2.0                                libwget-thread(3)

Detailed Description

       This is a wrapper around Gnulib's glthread functionality.

       It currently supports Posix threads (pthreads), GNU Pth threads, Solaris threads and Windows threads.

Function Documentation

intwget_thread_mutex_init(wget_thread_mutex*mutex)Parametersmutex The mutex to initialize

       Returns
           0 on success, non-zero on failure

       Initializes the mutex.

       After usage, a call to wget_thread_mutex_destroy() frees the allocated resources.

   intwget_thread_mutex_destroy(wget_thread_mutex*mutex)Parametersmutex The mutex to destroy

       Returns
           0 on success, non-zero on failure

       Free's the mutex and it's resources.

       After calling this function, the mutex cannot be used any more.

   voidwget_thread_mutex_lock(wget_thread_mutexmutex)Parametersmutex The mutex to be locked

       Creates a lock on the mutex.

       To unlock the mutex, call wget_thread_mutex_unlock().

   voidwget_thread_mutex_unlock(wget_thread_mutexmutex)Parametersmutex The mutex to be unlocked

       Unlocks the mutex.

   intwget_thread_cond_init(wget_thread_cond*cond)Parameterscond The conditional to initialize

       Returns
           0 on success, non-zero on failure

       Initializes the conditional cond.

       After usage, a call to wget_thread_cond_destroy() frees the allocated resources.

   intwget_thread_cond_destroy(wget_thread_cond*cond)Parameterscond The conditional to destroy

       Returns
           0 on success, non-zero on failure

       Free's the conditional cond and it's resources.

       After calling this function, cond cannot be used any more.

   intwget_thread_cond_signal(wget_thread_condcond)Parameterscond The conditional to signal a condition

       Returns
           0 on success, non-zero on failure

       Wakes up one (random) thread that waits on the conditional.

   intwget_thread_cond_wait(wget_thread_condcond,wget_thread_mutexmutex,longlongms)Parameterscond The conditional to wait for
           mutex The mutex needed for thread-safety
           ms The wait timeout in milliseconds

       Returns
           0 on 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.

   intwget_thread_start(wget_thread*thread,void*(*)(void*)start_routine,void*arg,WGET_GCC_UNUSEDintflags)Parametersthread The thread variable to be initialized
           start_routine The thread function to start
           arg The argument given to start_routine
           flags Currently unused

       Returns
           0 on success, non-zero on failure

       Start start_routine as own thread with argument arg.

   intwget_thread_cancel(WGET_GCC_UNUSEDwget_threadthread)Parametersthread Thread to cancel

       Returns
           0 on success, non-zero on failure

       Currently a no-op function, since it's not portable.

   intwget_thread_kill(WGET_GCC_UNUSEDwget_threadthread,WGET_GCC_UNUSEDintsig)Parametersthread Thread to send the signal to
           sig Signal to send

       Returns
           0 on success, non-zero on failure

       Currently a no-op function, since it's not portable.

   intwget_thread_join(wget_thread*thread)Parametersthread Thread to wait for

       Returns
           0 on 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.

   wget_thread_idwget_thread_self(void)Returns
           The thread id of the caller.

   boolwget_thread_support(void)Returns
           Whether libwget supports multi-threading on this platform or not.

Name

       libwget-thread - Implementation of multi-threading basic functionality

Synopsis

DataStructures
       struct wget_thread_st
       struct wget_thread_mutex_st
       struct wget_thread_cond_stFunctions
       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)

See Also