aboutsummaryrefslogtreecommitdiffstats
path: root/code/platform_linux/linux_semaphore_wrapper.h
blob: 3fa719192611af60ef2f3f0a1c0e002be57fe296 (plain) (blame)
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
/*
 * Mr. 4th Dimention - Allen Webster
 *
 * 07.11.2017
 *
 * Linux semaphore wrapper
 *
 */

// TOP

union Semaphore{
    sem_t s;
    FixSize(SEMAPHORE_TYPE_SIZE);
};

internal void
system_init_semaphore(Semaphore *s, u32 count){
    sem_init(&s->s, 0, 0);
}

internal void
system_wait_on_semaphore(Semaphore *s){
    sem_wait(&s->s);
}

internal void
system_release_semaphore(Semaphore *s){
    sem_post(&s->s);
}

// BOTTOM