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
14/* External library */
15#if defined(THREAD_POSIX)
16#include <pthread.h>
17#elif defined(THREAD_WIN32)
18#include <windows.h>
19#endif
20
21/* Engine */
22
23/* Standard */
24
36GF_DECLARE_TYPE(thread_context, {
37 void (*func)(void*);
38 void* data;
39});
40
41#if defined(THREAD_POSIX)
42GF_DECLARE_TYPE(thread, {
43 gf_thread_context_t context;
44 pthread_t thread;
45});
46#elif defined(THREAD_WIN32)
47GF_DECLARE_TYPE(thread, {
48 gf_thread_context_t context;
49 HANDLE thread;
50});
51#else
58GF_DECLARE_TYPE(thread, {});
59#endif
60#else
61typedef void gf_thread_t;
62typedef void gf_thread_context_t;
63#endif
64
65#endif
#define GF_DECLARE_TYPE(n, b)
Macro to define engine type shorter.
Definition gf_macro.h:164
Required headers before anything.
Thread context.
Definition thread.h:39
Platform-dependent thread.
Definition thread.h:58