source: azure_iot_hub/trunk/musl-1.1.18/include/threads.h@ 388

Last change on this file since 388 was 388, checked in by coas-nagasima, 5 years ago

Azure IoT Hub Device C SDK を使ったサンプルの追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 1.6 KB
Line 
1#ifndef _THREADS_H
2#define _THREADS_H
3
4#include <features.h>
5#include <time.h>
6
7#ifdef __cplusplus
8extern "C" {
9typedef unsigned long thrd_t;
10#else
11typedef struct __pthread *thrd_t;
12#define thread_local _Thread_local
13#endif
14
15typedef int once_flag;
16typedef unsigned tss_t;
17typedef int (*thrd_start_t)(void *);
18typedef void (*tss_dtor_t)(void *);
19
20#define __NEED_cnd_t
21#define __NEED_mtx_t
22
23#include <bits/alltypes.h>
24
25#define TSS_DTOR_ITERATIONS 4
26
27enum {
28 thrd_success = 0,
29 thrd_busy = 1,
30 thrd_error = 2,
31 thrd_nomem = 3,
32 thrd_timedout = 4,
33};
34
35enum {
36 mtx_plain = 0,
37 mtx_recursive = 1,
38 mtx_timed = 2,
39};
40
41#define ONCE_FLAG_INIT 0
42
43int thrd_create(thrd_t *, thrd_start_t, void *);
44_Noreturn void thrd_exit(int);
45
46int thrd_detach(thrd_t);
47int thrd_join(thrd_t, int *);
48
49int thrd_sleep(const struct timespec *, struct timespec *);
50void thrd_yield(void);
51
52thrd_t thrd_current(void);
53int thrd_equal(thrd_t, thrd_t);
54#ifndef __cplusplus
55#define thrd_equal(A, B) ((A) == (B))
56#endif
57
58void call_once(once_flag *, void (*)(void));
59
60int mtx_init(mtx_t *, int);
61void mtx_destroy(mtx_t *);
62
63int mtx_lock(mtx_t *);
64int mtx_timedlock(mtx_t *__restrict, const struct timespec *__restrict);
65int mtx_trylock(mtx_t *);
66int mtx_unlock(mtx_t *);
67
68int cnd_init(cnd_t *);
69void cnd_destroy(cnd_t *);
70
71int cnd_broadcast(cnd_t *);
72int cnd_signal(cnd_t *);
73
74int cnd_timedwait(cnd_t *__restrict, mtx_t *__restrict, const struct timespec *__restrict);
75int cnd_wait(cnd_t *, mtx_t *);
76
77int tss_create(tss_t *, tss_dtor_t);
78void tss_delete(tss_t);
79
80int tss_set(tss_t, void *);
81void *tss_get(tss_t);
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif
Note: See TracBrowser for help on using the repository browser.