GoldFish Engine
Quite simple and lightweight game engine
Loading...
Searching...
No Matches
thread.h
Go to the documentation of this file.
1
7#ifndef __GF_TYPE_THREAD_H__
8#define __GF_TYPE_THREAD_H__
9
10#include <gf_pre.h>
11#include <gf_macro.h>
12
13#ifdef GF_EXPOSE_THREAD
15typedef struct gf_thread_t gf_thread_t;
16
17/* External library */
18#if defined(THREAD_POSIX)
19#include <pthread.h>
20#elif defined(THREAD_WIN32)
21#include <windows.h>
22#endif
23
24/* Engine */
25
26/* Standard */
27
39GF_DECLARE_TYPE(thread_context, {
40 void (*func)(void*);
41 void* data;
42});
43
44#if defined(THREAD_POSIX)
45GF_DECLARE_TYPE(thread, {
46 gf_thread_context_t context;
47 pthread_t thread;
48});
49#elif defined(THREAD_WIN32)
50GF_DECLARE_TYPE(thread, {
51 gf_thread_context_t context;
52 HANDLE thread;
53});
54#else
61GF_DECLARE_TYPE(thread, {});
62#endif
63#else
64typedef void gf_thread_t;
65typedef void gf_thread_context_t;
66#endif
67
68#endif
#define GF_DECLARE_TYPE(n, b)
Macro to define engine type shorter.
Definition gf_macro.h:172
Required headers before anything.
Thread context.
Definition thread.h:42
Platform-dependent thread.
Definition thread.h:61