blob: 6eb096c81b63e2f4c8f56dd61c3aac00d7d1b4dc (
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
|
package sdl2
import "core:c"
when ODIN_OS == .Windows {
@(ignore_duplicates)
foreign import lib "SDL2.lib"
} else {
@(ignore_duplicates)
foreign import lib "system:SDL2"
}
MUTEX_TIMEDOUT :: 1
MUTEX_MAXWAIT :: ~u32(0)
mutex :: struct {}
semaphore :: struct {}
sem :: semaphore
cond :: struct {}
mutexP :: LockMutex
mutexV :: UnlockMutex
@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {
CreateMutex :: proc() -> ^mutex ---
LockMutex :: proc(m: ^mutex) -> c.int ---
TryLockMutex :: proc(m: ^mutex) -> c.int ---
UnlockMutex :: proc(m: ^mutex) -> c.int ---
DestroyMutex :: proc(m: ^mutex) ---
CreateSemaphore :: proc(initial_value: u32) -> ^sem ---
DestroySemaphore :: proc(s: ^sem) ---
SemWait :: proc(s: ^sem) -> c.int ---
SemTryWait :: proc(s: ^sem) -> c.int ---
SemWaitTimeout :: proc(s: ^sem, ms: u32) -> c.int ---
SemPost :: proc(s: ^sem) -> c.int ---
SemValue :: proc(s: ^sem) -> u32 ---
CreateCond :: proc() -> ^cond ---
DestroyCond :: proc(cv: ^cond) ---
CondSignal :: proc(cv: ^cond) -> c.int ---
CondBroadcast :: proc(cv: ^cond) -> c.int ---
CondWait :: proc(cv: ^cond, m: ^mutex) -> c.int ---
CondWaitTimeout :: proc(cv: ^cond, m: ^mutex, ms: u32) -> c.int ---
}
|