diff options
author | truelight <truelight@openttd.org> | 2006-08-19 09:23:48 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-19 09:23:48 +0000 |
commit | ee0daa0a4fdbafba224f48d7749ba13b79fa3fdc (patch) | |
tree | 7d50ad628902e6ab53e9f809daaf66e7ca463f50 /thread.c | |
parent | 7cfd3eb61834ee3d4c5037b0a3ffc71089b9564a (diff) | |
download | openttd-ee0daa0a4fdbafba224f48d7749ba13b79fa3fdc.tar.xz |
(svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
(who else) uses Thread in winbase.h, and starts complaining if you define it
otherwise (with weird, undefined errors) (tnx Arnau and Rubidium)
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -5,8 +5,8 @@ #include <stdlib.h> #if defined(__AMIGA__) || defined(__MORPHOS__) -Thread* OTTDCreateThread(ThreadFunc function, void* arg) { return NULL; } -void* OTTDJoinThread(Thread* t) { return NULL; } +OTTDThread* OTTDCreateThread(OTTDThreadFunc function, void* arg) { return NULL; } +void* OTTDJoinThread(OTTDThread* t) { return NULL; } #elif defined(__OS2__) @@ -15,22 +15,22 @@ void* OTTDJoinThread(Thread* t) { return NULL; } #include <os2.h> #include <process.h> -struct Thread { +struct OTTDThread { TID thread; - ThreadFunc func; + OTTDThreadFunc func; void* arg; void* ret; }; static void Proxy(void* arg) { - Thread* t = arg; + OTTDThread* t = arg; t->ret = t->func(t->arg); } -Thread* OTTDCreateThread(ThreadFunc function, void* arg) +OTTDThread* OTTDCreateThread(OTTDThreadFunc function, void* arg) { - Thread* t = malloc(sizeof(*t)); + OTTDThread* t = malloc(sizeof(*t)); if (t == NULL) return NULL; @@ -45,7 +45,7 @@ Thread* OTTDCreateThread(ThreadFunc function, void* arg) } } -void* OTTDJoinThread(Thread* t) +void* OTTDJoinThread(OTTDThread* t) { void* ret; @@ -62,13 +62,13 @@ void* OTTDJoinThread(Thread* t) #include <pthread.h> -struct Thread { +struct OTTDThread { pthread_t thread; }; -Thread* OTTDCreateThread(ThreadFunc function, void* arg) +OTTDThread* OTTDCreateThread(OTTDThreadFunc function, void* arg) { - Thread* t = malloc(sizeof(*t)); + OTTDThread* t = malloc(sizeof(*t)); if (t == NULL) return NULL; @@ -80,7 +80,7 @@ Thread* OTTDCreateThread(ThreadFunc function, void* arg) } } -void* OTTDJoinThread(Thread* t) +void* OTTDJoinThread(OTTDThread* t) { void* ret; @@ -96,23 +96,23 @@ void* OTTDJoinThread(Thread* t) #include <windows.h> -struct Thread { +struct OTTDThread { HANDLE thread; - ThreadFunc func; + OTTDThreadFunc func; void* arg; void* ret; }; static DWORD WINAPI Proxy(LPVOID arg) { - Thread* t = arg; + OTTDThread* t = arg; t->ret = t->func(t->arg); return 0; } -Thread* OTTDCreateThread(ThreadFunc function, void* arg) +OTTDThread* OTTDCreateThread(OTTDThreadFunc function, void* arg) { - Thread* t = malloc(sizeof(*t)); + OTTDThread* t = malloc(sizeof(*t)); DWORD dwThreadId; if (t == NULL) return NULL; @@ -129,7 +129,7 @@ Thread* OTTDCreateThread(ThreadFunc function, void* arg) } } -void* OTTDJoinThread(Thread* t) +void* OTTDJoinThread(OTTDThread* t) { void* ret; |