Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include
File: threads.h
/* ISO C11 Standard: 7.26 - Thread support library <threads.h>.
[0] Fix | Delete
Copyright (C) 2018 Free Software Foundation, Inc.
[1] Fix | Delete
This file is part of the GNU C Library.
[2] Fix | Delete
[3] Fix | Delete
The GNU C Library is free software; you can redistribute it and/or
[4] Fix | Delete
modify it under the terms of the GNU Lesser General Public
[5] Fix | Delete
License as published by the Free Software Foundation; either
[6] Fix | Delete
version 2.1 of the License, or (at your option) any later version.
[7] Fix | Delete
[8] Fix | Delete
The GNU C Library is distributed in the hope that it will be useful,
[9] Fix | Delete
but WITHOUT ANY WARRANTY; without even the implied warranty of
[10] Fix | Delete
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[11] Fix | Delete
Lesser General Public License for more details.
[12] Fix | Delete
[13] Fix | Delete
You should have received a copy of the GNU Lesser General Public
[14] Fix | Delete
License along with the GNU C Library; if not, see
[15] Fix | Delete
<http://www.gnu.org/licenses/>. */
[16] Fix | Delete
[17] Fix | Delete
#ifndef _THREADS_H
[18] Fix | Delete
#define _THREADS_H 1
[19] Fix | Delete
[20] Fix | Delete
#include <features.h>
[21] Fix | Delete
#include <time.h>
[22] Fix | Delete
[23] Fix | Delete
__BEGIN_DECLS
[24] Fix | Delete
[25] Fix | Delete
#include <bits/pthreadtypes-arch.h>
[26] Fix | Delete
#include <bits/types/struct_timespec.h>
[27] Fix | Delete
[28] Fix | Delete
#ifndef __cplusplus
[29] Fix | Delete
# define thread_local _Thread_local
[30] Fix | Delete
#endif
[31] Fix | Delete
[32] Fix | Delete
#define TSS_DTOR_ITERATIONS 4
[33] Fix | Delete
typedef unsigned int tss_t;
[34] Fix | Delete
typedef void (*tss_dtor_t) (void*);
[35] Fix | Delete
[36] Fix | Delete
typedef unsigned long int thrd_t;
[37] Fix | Delete
typedef int (*thrd_start_t) (void*);
[38] Fix | Delete
[39] Fix | Delete
/* Exit and error codes. */
[40] Fix | Delete
enum
[41] Fix | Delete
{
[42] Fix | Delete
thrd_success = 0,
[43] Fix | Delete
thrd_busy = 1,
[44] Fix | Delete
thrd_error = 2,
[45] Fix | Delete
thrd_nomem = 3,
[46] Fix | Delete
thrd_timedout = 4
[47] Fix | Delete
};
[48] Fix | Delete
[49] Fix | Delete
/* Mutex types. */
[50] Fix | Delete
enum
[51] Fix | Delete
{
[52] Fix | Delete
mtx_plain = 0,
[53] Fix | Delete
mtx_recursive = 1,
[54] Fix | Delete
mtx_timed = 2
[55] Fix | Delete
};
[56] Fix | Delete
[57] Fix | Delete
typedef struct
[58] Fix | Delete
{
[59] Fix | Delete
int __data __ONCE_ALIGNMENT;
[60] Fix | Delete
} once_flag;
[61] Fix | Delete
#define ONCE_FLAG_INIT { 0 }
[62] Fix | Delete
[63] Fix | Delete
typedef union
[64] Fix | Delete
{
[65] Fix | Delete
char __size[__SIZEOF_PTHREAD_MUTEX_T];
[66] Fix | Delete
long int __align __LOCK_ALIGNMENT;
[67] Fix | Delete
} mtx_t;
[68] Fix | Delete
[69] Fix | Delete
typedef union
[70] Fix | Delete
{
[71] Fix | Delete
char __size[__SIZEOF_PTHREAD_COND_T];
[72] Fix | Delete
__extension__ long long int __align __LOCK_ALIGNMENT;
[73] Fix | Delete
} cnd_t;
[74] Fix | Delete
[75] Fix | Delete
/* Threads functions. */
[76] Fix | Delete
[77] Fix | Delete
/* Create a new thread executing the function __FUNC. Arguments for __FUNC
[78] Fix | Delete
are passed through __ARG. If succesful, __THR is set to new thread
[79] Fix | Delete
identifier. */
[80] Fix | Delete
extern int thrd_create (thrd_t *__thr, thrd_start_t __func, void *__arg);
[81] Fix | Delete
[82] Fix | Delete
/* Check if __LHS and __RHS point to the same thread. */
[83] Fix | Delete
extern int thrd_equal (thrd_t __lhs, thrd_t __rhs);
[84] Fix | Delete
[85] Fix | Delete
/* Return current thread identifier. */
[86] Fix | Delete
extern thrd_t thrd_current (void);
[87] Fix | Delete
[88] Fix | Delete
/* Block current thread execution for at least the time pointed by
[89] Fix | Delete
__TIME_POINT. The current thread may resume if receives a signal. In
[90] Fix | Delete
that case, if __REMAINING is not NULL, the remaining time is stored in
[91] Fix | Delete
the object pointed by it. */
[92] Fix | Delete
extern int thrd_sleep (const struct timespec *__time_point,
[93] Fix | Delete
struct timespec *__remaining);
[94] Fix | Delete
[95] Fix | Delete
/* Terminate current thread execution, cleaning up any thread local
[96] Fix | Delete
storage and freeing resources. Returns the value specified in __RES. */
[97] Fix | Delete
extern void thrd_exit (int __res) __attribute__ ((__noreturn__));
[98] Fix | Delete
[99] Fix | Delete
/* Detach the thread identified by __THR from the current environment
[100] Fix | Delete
(it does not allow join or wait for it). */
[101] Fix | Delete
extern int thrd_detach (thrd_t __thr);
[102] Fix | Delete
[103] Fix | Delete
/* Block current thread until execution of __THR is complete. In case that
[104] Fix | Delete
__RES is not NULL, will store the return value of __THR when exiting. */
[105] Fix | Delete
extern int thrd_join (thrd_t __thr, int *__res);
[106] Fix | Delete
[107] Fix | Delete
/* Stop current thread execution and call the scheduler to decide which
[108] Fix | Delete
thread should execute next. The current thread may be selected by the
[109] Fix | Delete
scheduler to keep running. */
[110] Fix | Delete
extern void thrd_yield (void);
[111] Fix | Delete
[112] Fix | Delete
#ifdef __USE_EXTERN_INLINES
[113] Fix | Delete
/* Optimizations. */
[114] Fix | Delete
__extern_inline int
[115] Fix | Delete
thrd_equal (thrd_t __thread1, thrd_t __thread2)
[116] Fix | Delete
{
[117] Fix | Delete
return __thread1 == __thread2;
[118] Fix | Delete
}
[119] Fix | Delete
#endif
[120] Fix | Delete
[121] Fix | Delete
[122] Fix | Delete
/* Mutex functions. */
[123] Fix | Delete
[124] Fix | Delete
/* Creates a new mutex object with type __TYPE. If successful the new
[125] Fix | Delete
object is pointed by __MUTEX. */
[126] Fix | Delete
extern int mtx_init (mtx_t *__mutex, int __type);
[127] Fix | Delete
[128] Fix | Delete
/* Block the current thread until the mutex pointed to by __MUTEX is
[129] Fix | Delete
unlocked. In that case current thread will not be blocked. */
[130] Fix | Delete
extern int mtx_lock (mtx_t *__mutex);
[131] Fix | Delete
[132] Fix | Delete
/* Block the current thread until the mutex pointed by __MUTEX is unlocked
[133] Fix | Delete
or time pointed by __TIME_POINT is reached. In case the mutex is unlock,
[134] Fix | Delete
the current thread will not be blocked. */
[135] Fix | Delete
extern int mtx_timedlock (mtx_t *__restrict __mutex,
[136] Fix | Delete
const struct timespec *__restrict __time_point);
[137] Fix | Delete
[138] Fix | Delete
/* Try to lock the mutex pointed by __MUTEX without blocking. If the mutex
[139] Fix | Delete
is free the current threads takes control of it, otherwise it returns
[140] Fix | Delete
immediately. */
[141] Fix | Delete
extern int mtx_trylock (mtx_t *__mutex);
[142] Fix | Delete
[143] Fix | Delete
/* Unlock the mutex pointed by __MUTEX. It may potentially awake other
[144] Fix | Delete
threads waiting on this mutex. */
[145] Fix | Delete
extern int mtx_unlock (mtx_t *__mutex);
[146] Fix | Delete
[147] Fix | Delete
/* Destroy the mutex object pointed by __MUTEX. */
[148] Fix | Delete
extern void mtx_destroy (mtx_t *__mutex);
[149] Fix | Delete
[150] Fix | Delete
[151] Fix | Delete
/* Call function __FUNC exactly once, even if invoked from several threads.
[152] Fix | Delete
All calls must be made with the same __FLAGS object. */
[153] Fix | Delete
extern void call_once (once_flag *__flag, void (*__func)(void));
[154] Fix | Delete
[155] Fix | Delete
[156] Fix | Delete
/* Condition variable functions. */
[157] Fix | Delete
[158] Fix | Delete
/* Initialize new condition variable pointed by __COND. */
[159] Fix | Delete
extern int cnd_init (cnd_t *__cond);
[160] Fix | Delete
[161] Fix | Delete
/* Unblock one thread that currently waits on condition variable pointed
[162] Fix | Delete
by __COND. */
[163] Fix | Delete
extern int cnd_signal (cnd_t *__cond);
[164] Fix | Delete
[165] Fix | Delete
/* Unblock all threads currently waiting on condition variable pointed by
[166] Fix | Delete
__COND. */
[167] Fix | Delete
extern int cnd_broadcast (cnd_t *__cond);
[168] Fix | Delete
[169] Fix | Delete
/* Block current thread on the condition variable pointed by __COND. */
[170] Fix | Delete
extern int cnd_wait (cnd_t *__cond, mtx_t *__mutex);
[171] Fix | Delete
[172] Fix | Delete
/* Block current thread on the condition variable until condition variable
[173] Fix | Delete
pointed by __COND is signaled or time pointed by __TIME_POINT is
[174] Fix | Delete
reached. */
[175] Fix | Delete
extern int cnd_timedwait (cnd_t *__restrict __cond,
[176] Fix | Delete
mtx_t *__restrict __mutex,
[177] Fix | Delete
const struct timespec *__restrict __time_point);
[178] Fix | Delete
[179] Fix | Delete
/* Destroy condition variable pointed by __cond and free all of its
[180] Fix | Delete
resources. */
[181] Fix | Delete
extern void cnd_destroy (cnd_t *__COND);
[182] Fix | Delete
[183] Fix | Delete
[184] Fix | Delete
/* Thread specific storage functions. */
[185] Fix | Delete
[186] Fix | Delete
/* Create new thread-specific storage key and stores it in the object pointed
[187] Fix | Delete
by __TSS_ID. If __DESTRUCTOR is not NULL, the function will be called when
[188] Fix | Delete
the thread terminates. */
[189] Fix | Delete
extern int tss_create (tss_t *__tss_id, tss_dtor_t __destructor);
[190] Fix | Delete
[191] Fix | Delete
/* Return the value held in thread-specific storage for the current thread
[192] Fix | Delete
identified by __TSS_ID. */
[193] Fix | Delete
extern void *tss_get (tss_t __tss_id);
[194] Fix | Delete
[195] Fix | Delete
/* Sets the value of the thread-specific storage identified by __TSS_ID for
[196] Fix | Delete
the current thread to __VAL. */
[197] Fix | Delete
extern int tss_set (tss_t __tss_id, void *__val);
[198] Fix | Delete
[199] Fix | Delete
/* Destroys the thread-specific storage identified by __TSS_ID. The
[200] Fix | Delete
destructor is not called until thrd_exit is called. */
[201] Fix | Delete
extern void tss_delete (tss_t __tss_id);
[202] Fix | Delete
[203] Fix | Delete
__END_DECLS
[204] Fix | Delete
[205] Fix | Delete
#endif /* _THREADS_H */
[206] Fix | Delete
[207] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function