blob: 86d5d58ad07c2b87e5d4849e86852063485043f1 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#ifndef BASE_THREAD_H
#define BASE_THREAD_H
// platform agnostic thread buffer
typedef struct Thread Thread;
struct Thread {
#if PLATFORM_LINUX
pthread_t id;
#endif
u64 data[2];
s32 input;
s32 result;
};
typedef struct ThreadPool ThreadPool;
struct ThreadPool {
Thread *threads;
u64 count;
};
//- os impementations for threading
// note: keeping the implementation linux specific for now
#if PLATFORM_LINUX
typedef void (*ThreadProc)(void *arg);
internal b32 thread_launch(Thread *t, ThreadProc proc, void *arg);
internal void thread_join();
internal void thread_attach();
internal void thread_exit();
internal void thread_get_current();
internal void thread_compare();
internal void mutex_create();
internal void mutex_destroy();
internal void mutex_lock();
internal void mutex_unlock();
#elif PLATFORM_WINDOWS
#else
#error unsupported platform
#endif
#endif // BASE_THREAD_H
|