thread.c
author KUDr
Mon, 01 Jan 2007 23:37:39 +0000
branchcustombridgeheads
changeset 5629 7cb2c58f4a7c
parent 4324 9c999cc382fa
child 5502 7faea30b9be0
permissions -rw-r--r--
(svn r7735) - Fix: mingw compilation error (glx)
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     1
/* $Id$ */
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     2
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     3
#include "stdafx.h"
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     4
#include "thread.h"
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     5
#include <stdlib.h>
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     6
4324
9c999cc382fa (svn r5978) -Add: allow a switch in Makefile.config to disable threads in OpenTTD (no matter what system you are on). Only useful for testing.
truelight
parents: 4300
diff changeset
     7
#if defined(__AMIGA__) || defined(__MORPHOS__) || defined(NO_THREADS)
9c999cc382fa (svn r5978) -Add: allow a switch in Makefile.config to disable threads in OpenTTD (no matter what system you are on). Only useful for testing.
truelight
parents: 4300
diff changeset
     8
OTTDThread *OTTDCreateThread(OTTDThreadFunc function, void *arg) { return NULL; }
9c999cc382fa (svn r5978) -Add: allow a switch in Makefile.config to disable threads in OpenTTD (no matter what system you are on). Only useful for testing.
truelight
parents: 4300
diff changeset
     9
void *OTTDJoinThread(OTTDThread *t) { return NULL; }
9c999cc382fa (svn r5978) -Add: allow a switch in Makefile.config to disable threads in OpenTTD (no matter what system you are on). Only useful for testing.
truelight
parents: 4300
diff changeset
    10
void OTTDExitThread(void) { NOT_REACHED(); };
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    11
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    12
#elif defined(__OS2__)
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    13
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    14
#define INCL_DOS
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    15
#include <os2.h>
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    16
#include <process.h>
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    17
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    18
struct OTTDThread {
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    19
	TID thread;
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    20
	OTTDThreadFunc func;
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    21
	void* arg;
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    22
	void* ret;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    23
};
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    24
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    25
static void Proxy(void* arg)
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    26
{
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    27
	OTTDThread* t = arg;
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    28
	t->ret = t->func(t->arg);
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    29
}
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    30
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    31
OTTDThread* OTTDCreateThread(OTTDThreadFunc function, void* arg)
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    32
{
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    33
	OTTDThread* t = malloc(sizeof(*t));
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    34
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    35
	if (t == NULL) return NULL;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    36
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    37
	t->func = function;
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    38
	t->arg  = arg;
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    39
	t->thread = _beginthread(Proxy, NULL, 32768, t);
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    40
	if (t->thread != -1) {
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    41
		return t;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    42
	} else {
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    43
		free(t);
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    44
		return NULL;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    45
	}
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    46
}
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    47
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    48
void* OTTDJoinThread(OTTDThread* t)
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    49
{
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    50
	void* ret;
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    51
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    52
	if (t == NULL) return NULL;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    53
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    54
	DosWaitThread(&t->thread, DCWW_WAIT);
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    55
	ret = t->ret;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    56
	free(t);
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    57
	return ret;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    58
}
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    59
4300
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
    60
void OTTDExitThread(void)
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
    61
{
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
    62
	_endthread();
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
    63
}
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    64
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    65
#elif defined(UNIX)
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    66
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    67
#include <pthread.h>
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    68
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    69
struct OTTDThread {
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    70
	pthread_t thread;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    71
};
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    72
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    73
OTTDThread* OTTDCreateThread(OTTDThreadFunc function, void* arg)
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    74
{
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    75
	OTTDThread* t = malloc(sizeof(*t));
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    76
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    77
	if (t == NULL) return NULL;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    78
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    79
	if (pthread_create(&t->thread, NULL, function, arg) == 0) {
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    80
		return t;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    81
	} else {
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    82
		free(t);
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    83
		return NULL;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    84
	}
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    85
}
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    86
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
    87
void* OTTDJoinThread(OTTDThread* t)
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    88
{
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    89
	void* ret;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    90
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    91
	if (t == NULL) return NULL;
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    92
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    93
	pthread_join(t->thread, &ret);
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    94
	free(t);
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    95
	return ret;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    96
}
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    97
4300
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
    98
void OTTDExitThread(void)
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
    99
{
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
   100
	pthread_exit(NULL);
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
   101
}
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   102
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   103
#elif defined(WIN32)
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   104
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   105
#include <windows.h>
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   106
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
   107
struct OTTDThread {
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   108
	HANDLE thread;
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
   109
	OTTDThreadFunc func;
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   110
	void* arg;
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   111
	void* ret;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   112
};
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   113
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   114
static DWORD WINAPI Proxy(LPVOID arg)
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   115
{
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
   116
	OTTDThread* t = arg;
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   117
	t->ret = t->func(t->arg);
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   118
	return 0;
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   119
}
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   120
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
   121
OTTDThread* OTTDCreateThread(OTTDThreadFunc function, void* arg)
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   122
{
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
   123
	OTTDThread* t = malloc(sizeof(*t));
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   124
	DWORD dwThreadId;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   125
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   126
	if (t == NULL) return NULL;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   127
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   128
	t->func = function;
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   129
	t->arg  = arg;
2287
2e556bae5fbb (svn r2811) Fix typos in r2810
tron
parents: 2286
diff changeset
   130
	t->thread = CreateThread(NULL, 0, Proxy, t, 0, &dwThreadId);
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   131
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   132
	if (t->thread != NULL) {
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   133
		return t;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   134
	} else {
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   135
		free(t);
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   136
		return NULL;
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   137
	}
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   138
}
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   139
4298
3417f80deca1 (svn r5943) -Merge TGP (part r5725): -Codechange: renamed Thread to OTTDThread, as Windows
truelight
parents: 2290
diff changeset
   140
void* OTTDJoinThread(OTTDThread* t)
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   141
{
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   142
	void* ret;
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   143
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   144
	if (t == NULL) return NULL;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   145
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   146
	WaitForSingleObject(t->thread, INFINITE);
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   147
	CloseHandle(t->thread);
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   148
	ret = t->ret;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   149
	free(t);
2286
acb76b379e72 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
   150
	return ret;
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   151
}
4300
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
   152
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
   153
void OTTDExitThread(void)
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
   154
{
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
   155
	ExitThread(0);
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4298
diff changeset
   156
}
2285
3193cbd1ba88 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
   157
#endif