blob: 0226efd82c29c6567876cc9f53c71ef4dec7123e (
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
|
#include <pthread.h>
#include <semaphore.h>
struct bh_thread_s
{
pthread_t handle;
int allocated;
};
struct bh_mutex_s
{
pthread_mutex_t handle;
};
struct bh_semaphore_s
{
sem_t handle;
};
struct bh_cond_s
{
pthread_cond_t handle;
};
struct bh_spinlock_s
{
int handle;
};
int bh_thread_init(bh_thread_t *thread,
bh_task_t *task);
int bh_mutex_init(bh_mutex_t *mutex);
void bh_mutex_destroy(bh_mutex_t *mutex);
int bh_semaphore_init(bh_semaphore_t *semaphore,
int count);
void bh_semaphore_destroy(bh_semaphore_t *semaphore);
int bh_cond_init(bh_cond_t *cond);
void bh_cond_destroy(bh_cond_t *cond);
int bh_thread_pool_init(bh_thread_pool_t *pool,
size_t size);
void bh_thread_pool_destroy(bh_thread_pool_t *pool);
|