mailing list of musl libc
 help / color / mirror / code / Atom feed
0e99443e315a72e80f6d350026e1d70e9b991c93 blob 2488 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
 
#ifndef _THREADS_H
#define _THREADS_H

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


#ifdef __cplusplus
extern "C" {
#endif

/* These may or may not be implemented to be the same as some POSIX
 * types. Don't rely on any assumption about that, in particular if
 * you happen to use both interfaces in the same code. */

#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*);

/* This should be a keyword for C++11 */
#ifndef __cplusplus
# define thread_local _Thread_local
#endif

  /* The following list of 10 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 10 parameters are those that we proposed to
     glibc, in the hope that they will agree.
  */

#define TSS_DTOR_ITERATIONS 4

enum {
  thrd_success  = 0,
  thrd_busy     = 1,
  thrd_error    = 2,
  thrd_nomem    = 3,
  thrd_timedout = 4,
};

enum {
  mtx_plain     = 0,
  mtx_recursive = 1,
  // all mutexes are timed, here. so this is a no-op
  mtx_timed     = 2,
};

#define ONCE_FLAG_INIT { 0 }

#ifdef __cplusplus
extern "C" {
#endif

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

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

int thrd_sleep(const struct timespec *, struct timespec *);
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));

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

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

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

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

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

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

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

#ifdef __cplusplus
}
#endif

#endif
debug log:

solving 0e99443 ...
found 0e99443 in https://inbox.vuxu.org/musl/cb03e88ca7f717c106c0aa7283202fd2f7c7f327.1409524413.git.Jens.Gustedt@inria.fr/ ||
	https://inbox.vuxu.org/musl/cb03e88ca7f717c106c0aa7283202fd2f7c7f327.1409423162.git.Jens.Gustedt@inria.fr/

applying [1/2] https://inbox.vuxu.org/musl/cb03e88ca7f717c106c0aa7283202fd2f7c7f327.1409524413.git.Jens.Gustedt@inria.fr/
diff --git a/include/threads.h b/include/threads.h
new file mode 100644
index 0000000..0e99443

Checking patch include/threads.h...
Applied patch include/threads.h cleanly.

skipping https://inbox.vuxu.org/musl/cb03e88ca7f717c106c0aa7283202fd2f7c7f327.1409423162.git.Jens.Gustedt@inria.fr/ for 0e99443
index at:
100644 0e99443e315a72e80f6d350026e1d70e9b991c93	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).