mailing list of musl libc
 help / color / mirror / code / Atom feed
349c84c903acfadf19f43d9ddd5d37220fad82ea blob 5193 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
 
#ifndef _THREADS_H
#define _THREADS_H

/* This one is explicitly allowed to be included. */
#include <time.h>

#ifdef __GNUC__
#define _Nonnull(...) __attribute__((__nonnull__(__VA_ARGS__)))
#else
#define _Nonnull(...)
#endif



#ifdef __cplusplus
extern "C" {
#endif

#define __NEED___pthread_cond_t
#define __NEED___pthread_mutex_t
#define __NEED_cnd_t
#define __NEED_mtx_t
#define __NEED_once_flag
#define __NEED_thrd_t
#define __NEED_tss_t

#include <bits/alltypes.h>

typedef int (*thrd_start_t)(void*);
typedef void (*tss_dtor_t)(void*);


#ifndef __THRD_EXPERIMENTAL
# define __THRD_EXPERIMENTAL 1
#endif

  /* The following list of 9 integer constants makes up for the binary
     compatibility of this C thread implementation. You must never
     link code against versions of the C library that do not agree
     upon these ABI parameters.

     Additionally this implementation assumes that the 5 types have
     the same size across C libraries and that these types can be
     initialized by the default initializer.

     The values for the 9 parameters are not fixed for now. Depending
     on the choices of other implementations and the evolution of the
     C standard they may still change. This should happen rarely, but
     you have to consider the C thread feature to be experimental
     until then, and be prepared to recompile your binary when linking
     against a different implementation or a new version.

     The macro __THRD_EXPERIMENTAL will be defined as long as we
     consider this ABI to be unstable. This comes with some link time
     checks and an overhead of some bytes. At your own risk you may
     switch this check off by defining __THRD_EXPERIMENTAL macro to
     0. */

#define __THRD_SUCCESS      0
#define __THRD_BUSY         1
#define __THRD_ERROR        2
#define __THRD_NOMEM        3
#define __THRD_TIMEDOUT     4
#define __MTX_PLAIN         0
#define __MTX_RECURSIVE     1
#define __MTX_TIMED         2
#define TSS_DTOR_ITERATIONS 4

#define __THRD_CONCAT10_(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9)         \
_0 ## _ ## _1 ## _ ## _2 ## _ ## _3 ## _ ## _4 ## _ ## _5 ## _ ## _6 ## _ ## _7 ## _ ## _8 ## _ ## _9

#define __THRD_CONCAT10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
  __THRD_CONCAT10_(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9)


#define __THRD_ABI                              \
__THRD_CONCAT10(__thrd_abi,                     \
                __THRD_SUCCESS,                 \
                __THRD_BUSY,                    \
                __THRD_ERROR,                   \
                __THRD_NOMEM,                   \
                __THRD_TIMEDOUT,                \
                __MTX_PLAIN,                    \
                __MTX_RECURSIVE,                \
                __MTX_TIMED,                    \
                TSS_DTOR_ITERATIONS             \
                )

#define __THRD_SHFT(X, Y) (((X) << 3) ^ (Y))

enum {
  __thrd_abi =
  __THRD_SHFT(sizeof(cnd_t),
              __THRD_SHFT(sizeof(mtx_t),
                          __THRD_SHFT(sizeof(once_flag),
                                      __THRD_SHFT(sizeof(thrd_t),
                                                  sizeof(tss_t))))),
};

extern unsigned const __THRD_ABI;

#define __THRD_ABI_CHECK (1/(__THRD_ABI == __thrd_abi))

#if __THRD_EXPERIMENTAL
# define __THRD_ABI_MARK __attribute__((used)) static unsigned const*const __thrd_abi_mark = &__THRD_ABI
#else
# define __THRD_ABI_MARK typedef unsigned __thrd_abi_dummy_type
#endif

enum {
  thrd_success = __THRD_SUCCESS,
  thrd_busy = __THRD_BUSY,
  thrd_error = __THRD_ERROR,
  thrd_nomem = __THRD_NOMEM,
  thrd_timedout = __THRD_TIMEDOUT,
};

enum {
  mtx_plain = __MTX_PLAIN,
  mtx_recursive = __MTX_RECURSIVE,
  // all mutexes are timed, here. so this is a no-op
  mtx_timed = __MTX_TIMED,
};

#define ONCE_FLAG_INIT { 0 }
#define thread_local _Thread_local

int thrd_create(thrd_t *, thrd_start_t, void *) _Nonnull(1);
_Noreturn void thrd_exit(int);

int thrd_detach(thrd_t);
int thrd_join(thrd_t, int *);

int thrd_sleep(const struct timespec *, struct timespec *) _Nonnull(1);
void thrd_yield(void);

thrd_t thrd_current(void);
int thrd_equal(thrd_t, thrd_t);
#define thrd_equal(A, B) ((A) == (B))

void call_once(once_flag *, void (*)(void)) _Nonnull(1, 2);

int mtx_init(mtx_t *, int) _Nonnull(1);
void mtx_destroy(mtx_t *) _Nonnull(1);

int mtx_lock(mtx_t *) _Nonnull(1);
int mtx_timedlock(mtx_t *restrict, const struct timespec *restrict) _Nonnull(1);
int mtx_trylock(mtx_t *) _Nonnull(1);
int mtx_unlock(mtx_t *) _Nonnull(1);

int cnd_init(cnd_t *) _Nonnull(1);
void cnd_destroy(cnd_t *) _Nonnull(1);

int cnd_broadcast(cnd_t *) _Nonnull(1);
int cnd_signal(cnd_t *) _Nonnull(1);

int cnd_timedwait(cnd_t *restrict, mtx_t *restrict, const struct timespec *restrict) _Nonnull(1, 2);
int cnd_wait(cnd_t *, mtx_t *) _Nonnull(1, 2);

int tss_create(tss_t *, tss_dtor_t) _Nonnull(1);
void tss_delete(tss_t key);

int tss_set(tss_t, void *);
void *tss_get(tss_t);

#ifdef __cplusplus
}
#endif

#endif
debug log:

solving cc396c3 ...
found cc396c3 in https://inbox.vuxu.org/musl/1409177505.4476.75.camel@eris.loria.fr/

applying [1/1] https://inbox.vuxu.org/musl/1409177505.4476.75.camel@eris.loria.fr/
diff --git a/include/threads.h b/include/threads.h\r
new file mode 100644\r
index 0000000..cc396c3\r

1:7: trailing whitespace.
#ifndef _THREADS_H\r
1:8: trailing whitespace.
#define _THREADS_H\r
1:9: trailing whitespace.
\r
1:10: trailing whitespace.
/* This one is explicitly allowed to be included. */\r
1:11: trailing whitespace.
#include <time.h>\r
Checking patch include/threads.h...
Applied patch include/threads.h cleanly.
warning: squelched 165 whitespace errors
warning: 170 lines add whitespace errors.

index at:
100644 349c84c903acfadf19f43d9ddd5d37220fad82ea	include/threads.h

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).