aboutsummaryrefslogtreecommitdiff
path: root/src/Platform/Posix/Thread.h
blob: 84fb0af25c8ca79a245780453f97afa716789157 (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
#ifndef BH_PLATFORM_POSIX_THREAD_H
#define BH_PLATFORM_POSIX_THREAD_H


#include <BH/Thread.h>
#include <unistd.h>
#include <pthread.h>


struct BH_Condition
{
    pthread_cond_t handle;
};


struct BH_Mutex
{
    pthread_mutex_t handle;
};


#if (_POSIX_SEMAPHORES >= 200112L)
#include <semaphore.h>

struct BH_Semaphore
{
    sem_t handle;
};
#else
struct BH_Semaphore
{
    int count;
    int waiters;
    pthread_mutex_t mutex;
    pthread_cond_t condition;
};
#endif


struct BH_Thread
{
    pthread_t handle;
};


void BH_TssCleanup(void);

#endif /* BH_PLATFORM_POSIX_THREAD_H */