summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/wamr-sdk/app/libc-builtin-sysroot/include/pthread.h
blob: 10b3978e9b1008a9fe237637dd8d96d4e67dac00 (plain)
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
/*
 * Copyright (C) 2019 Intel Corporation.  All rights reserved.
 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 */

#ifndef _WAMR_LIB_PTHREAD_H
#define _WAMR_LIB_PTHREAD_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

/* Data type define of pthread, mutex, cond and key */
typedef unsigned int pthread_t;
typedef unsigned int pthread_mutex_t;
typedef unsigned int pthread_cond_t;
typedef unsigned int pthread_key_t;

/* Thread APIs */
int
pthread_create(pthread_t *thread, const void *attr,
               void *(*start_routine)(void *), void *arg);

int
pthread_join(pthread_t thread, void **retval);

int
pthread_detach(pthread_t thread);

int
pthread_cancel(pthread_t thread);

pthread_t
pthread_self(void);

void
pthread_exit(void *retval);

/* Mutex APIs */
int
pthread_mutex_init(pthread_mutex_t *mutex, const void *attr);

int
pthread_mutex_lock(pthread_mutex_t *mutex);

int
pthread_mutex_unlock(pthread_mutex_t *mutex);

int
pthread_mutex_destroy(pthread_mutex_t *mutex);

/* Cond APIs */
int
pthread_cond_init(pthread_cond_t *cond, const void *attr);

int
pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);

int
pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
                       uint64_t useconds);

int
pthread_cond_signal(pthread_cond_t *cond);

int
pthread_cond_broadcast(pthread_cond_t *cond);

int
pthread_cond_destroy(pthread_cond_t *cond);

/* Pthread key APIs */
int
pthread_key_create(pthread_key_t *key, void (*destructor)(void *));

int
pthread_setspecific(pthread_key_t key, const void *value);

void *
pthread_getspecific(pthread_key_t key);

int
pthread_key_delete(pthread_key_t key);

#ifdef __cplusplus
}
#endif

#endif /* end of _WAMR_LIB_PTHREAD_H */