thread.h
author tron
Sun, 28 Aug 2005 14:45:44 +0000
changeset 2374 e4443eab6293
parent 2286 733dbf6b4545
child 2380 392bba57462d
permissions -rw-r--r--
(svn r2900) Fix a bug, which incremented the counter of a loop twice and therefore calculated wrong argument indices
2285
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     1
/* $Id$ */
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     2
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     3
#ifndef THREAD_H
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     4
#define THREAD_H
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     5
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     6
/*
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     7
 * DO NOT USE THREADS if you don't know what race conditions, mutexes,
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     8
 * semaphores, atomic operations, etc. are or how to properly handle them.
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
     9
 * Ask somebody who has a clue.
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    10
 */
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    11
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    12
typedef struct Thread Thread;
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    13
2286
733dbf6b4545 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    14
typedef void* (*ThreadFunc)(void*);
2285
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    15
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    16
Thread* OTTDCreateThread(ThreadFunc, void*);
2286
733dbf6b4545 (svn r2810) Threads may now return information when they terminate using a void*.
tron
parents: 2285
diff changeset
    17
void*   OTTDJoinThread(Thread*);
2285
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    18
410dedcf46d1 (svn r2809) Implement more generic threading functions, which allow more than one thread
tron
parents:
diff changeset
    19
#endif