Lines Matching refs:thread
35 * ISO C Condition Variables:: High-level objects for thread synchronization.
36 * ISO C Thread-local Storage:: Functions to support thread-local storage.
43 The ISO C thread specification provides the following enumeration
74 @cindex thread creation
75 @cindex thread control
76 @cindex thread management
86 A unique object that identifies a thread.
92 @code{thrd_create} when creating a new thread. It should point to the
93 first function that thread will run.
101 @code{thrd_create} creates a new thread that will execute the function
104 thread identifier.
113 This function returns the identifier of the calling thread.
120 same thread. If @var{lhs} and @var{rhs} are different threads, this
127 @code{thrd_sleep} blocks the execution of the current thread for at
130 that the thread is required to be blocked. @xref{Time Basics}, and
133 The thread may wake early if a signal that is not ignored is received.
147 the execution of the current thread, allowing other threads to run.
153 @code{thrd_exit} terminates execution of the calling thread and sets
159 function that started a thread is equivalent to calling
166 @code{thrd_detach} detaches the thread identified by @code{thr} from
167 the current control thread. The resources held by the detached thread
168 will be freed automatically once the thread exits. The parent thread
171 Calling @code{thrd_detach} on a thread that was previously detached or
172 joined by another thread results in undefined behavior.
180 @code{thrd_join} blocks the current thread until the thread identified
182 result code of the thread is put into the location pointed to by
183 @var{res}. The termination of the thread @dfn{synchronizes-with} the
187 Calling @code{thrd_join} on a thread that was previously detached or
188 joined by another thread results in undefined behavior.
251 thread can lock it more than once without causing deadlock.
290 @code{mtx_lock} blocks the current thread until the mutex pointed to
292 thread has already locked the mutex and the mutex is not recursive.
305 @code{mtx_timedlock} blocks the current thread until the mutex pointed
311 If the current thread has already locked the mutex and the mutex is
345 thread.
397 @code{cnd_signal} unblocks one thread that is currently waiting on the
398 condition variable pointed to by @var{cond}. If a thread is
421 the thread is signaled by @code{cnd_signal} or @code{cnd_broadcast}.
432 @var{cond} until the thread is signaled by @code{cnd_signal} or
456 @cindex thread-local storage
458 @Theglibc{} implements functions to provide @dfn{thread-local
460 per-thread storage, lifetimes that match the thread lifetime, and
461 destructors that cleanup the unique per-thread storage.
463 Several data types and macros exist for working with thread-local
468 The @code{tss_t} data type identifies a thread-specific storage
469 object. Even if shared, every thread will have its own instance of
476 (void *)}, to be used as a thread-specific storage destructor. The
477 function will be called when the current thread calls @code{thrd_exit}
483 @code{thread_local} is used to mark a variable with thread storage
484 duration, which means it is created when the thread starts and cleaned
485 up when the thread ends.
494 representing the maximum number of iterations over all thread-local
495 destructors at the time of thread termination. This value provides a
496 bounded limit to the destruction of thread-local storage; e.g.,
497 consider a destructor that creates more thread-local storage.
500 The following functions are used to manage thread-local storage:
505 @code{tss_create} creates a new thread-specific storage key and stores
508 @code{tss_set} are maintained on a per-thread basis and persist for
509 the life of the calling thread.
512 and called when the thread finishes its execution by calling
516 successfully set to a unique value for the thread; otherwise,
524 @code{tss_set} sets the value of the thread-specific storage
525 identified by @var{tss_key} for the current thread to @var{val}.
535 thread-specific storage for the current thread. Different threads may
543 @code{tss_delete} destroys the thread-specific storage identified by
556 managing thread-specific data
565 data specific to a thread. Such data may be destroyed at thread exit,
574 Create a thread-specific data key for the calling thread, referenced by
578 before thread-specific data, so they should not be used in thread-specific
579 data destructors or even as members of the thread-specific data, since the
590 Destroy the thread-specific data @var{key} in the calling thread. The
591 destructor for the thread-specific data is not called during destruction, nor
592 is it called during thread exit.
599 Return the thread-specific data associated with @var{key} in the calling
600 thread.
614 Associate the thread-specific @var{value} with @var{key} in the calling thread.
637 @subsubsection Setting Process-wide defaults for thread attributes
682 thread created using @code{pthread_create}, passing a thread attribute
693 thread is inherited from the thread that calls @code{pthread_create}.
711 mask of the specified thread, and @code{pthread_attr_getsigmask_np}
720 It is possible to create a new thread with a specific signal mask
721 without using these functions. On the thread that calls
727 @code{pthread_sigmask}. This ensures that the new thread will be
729 to the thread until the desired signal mask is set.
732 Call @code{pthread_create} to create the new thread, passing the
733 desired signal mask to the thread start routine (which could be a
734 wrapper function for the actual thread start routine). It may be
740 Restore the thread's signal mask, to the set that was saved in the
744 The start routine for the created thread needs to locate the desired
745 signal mask and use @code{pthread_sigmask} to apply it to the thread.
776 @c In the AC case we would cancel the thread and the mutex would remain
815 @deftypefun int pthread_tryjoin_np (pthread_t *@var{thread},
820 immediately if the thread specified by @var{thread} has not yet terminated.
825 @deftypefun int pthread_timedjoin_np (pthread_t *@var{thread},
832 reached if the thread has not terminated by that time and return
839 @deftypefun int pthread_clockjoin_np (pthread_t *@var{thread},
855 synchronization can be costly even if there is just a single thread
889 @c (second-to-last) thread happens-before setting
959 application-created thread because future versions of @theglibc{} may
960 create background threads after the first thread has been created, and
976 the thread pointer and the @code{__rseq_offset} variable, described
987 informing the kernel that the thread enters a restartable sequence
995 @code{NULL} in each thread's restartable sequence area to guarantee that
1009 This variable contains the offset between the thread pointer (as defined
1010 by @code{__builtin_thread_pointer} or the thread pointer register for
1013 is located at a lower address than the location to which the thread