Files
@ r10525:898f08b99221
Branch filter:
Location: cpp/openttd-patchpack/source/src/thread.h - annotation
r10525:898f08b99221
2.0 KiB
text/x-c
(svn r14782) -Update: WebTranslator2 update to 2009-01-02 18:38:20
arabic_egypt - 7 fixed by khaloofah (7)
brazilian_portuguese - 14 fixed, 5 changed by tucalipe (19)
catalan - 14 fixed by arnaullv (14)
finnish - 14 fixed by jpx_ (14)
hungarian - 14 fixed by alyr (14)
indonesian - 6 changed by fanioz (6)
korean - 13 fixed by dlunch (13)
malay - 8 fixed by tombakemas (8)
serbian - 29 fixed, 2 changed by nummer (31)
thai - 2 fixed by chat9780 (2)
ukrainian - 13 fixed by mad (1), znikoz (12)
urdu - 20 fixed by yasirniazkhan (20)
arabic_egypt - 7 fixed by khaloofah (7)
brazilian_portuguese - 14 fixed, 5 changed by tucalipe (19)
catalan - 14 fixed by arnaullv (14)
finnish - 14 fixed by jpx_ (14)
hungarian - 14 fixed by alyr (14)
indonesian - 6 changed by fanioz (6)
korean - 13 fixed by dlunch (13)
malay - 8 fixed by tombakemas (8)
serbian - 29 fixed, 2 changed by nummer (31)
thai - 2 fixed by chat9780 (2)
ukrainian - 13 fixed by mad (1), znikoz (12)
urdu - 20 fixed by yasirniazkhan (20)
r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r9111:983de9c5a848 r6422:5983361e241a r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r9476:dfe3d556ae24 r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r5475:3f5cd13d1b63 r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r9476:dfe3d556ae24 r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r5475:3f5cd13d1b63 r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r9479:31c691398ec3 r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r9476:dfe3d556ae24 r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r8934:d5858392238b r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 | /* $Id$ */
/** @file thread.h Base of all threads. */
#ifndef THREAD_H
#define THREAD_H
typedef void (*OTTDThreadFunc)(void *);
/**
* A Thread Object which works on all our supported OSes.
*/
class ThreadObject {
public:
/**
* Virtual destructor to allow 'delete' operator to work properly.
*/
virtual ~ThreadObject() {};
/**
* Check if the thread is currently running.
* @return True if the thread is running.
*/
virtual bool IsRunning() = 0;
/**
* Waits for the thread to exit.
* @return True if the thread has exited.
*/
virtual bool WaitForStop() = 0;
/**
* Exit this thread.
*/
virtual bool Exit() = 0;
/**
* Join this thread.
*/
virtual void Join() = 0;
/**
* Check if this thread is the current active thread.
* @return True if it is the current active thread.
*/
virtual bool IsCurrent() = 0;
/**
* Get the unique ID of this thread.
* @return A value unique to each thread.
*/
virtual uint GetId() = 0;
/**
* Create a thread; proc will be called as first function inside the thread,
* with optinal params.
* @param proc The procedure to call inside the thread.
* @param param The params to give with 'proc'.
* @return True if the thread was started correctly.
*/
static ThreadObject *New(OTTDThreadFunc proc, void *param);
/**
* Convert the current thread to a new ThreadObject.
* @return A new ThreadObject with the current thread attached to it.
*/
static ThreadObject *AttachCurrent();
/**
* Find the Id of the current running thread.
* @return The thread ID of the current active thread.
*/
static uint CurrentId();
};
/**
* Cross-platform Thread Semaphore. Wait() waits for a Set() of someone else.
*/
class ThreadSemaphore {
public:
static ThreadSemaphore *New();
/**
* Virtual Destructor to avoid compiler warnings.
*/
virtual ~ThreadSemaphore() {};
/**
* Signal all threads that are in Wait() to continue.
*/
virtual void Set() = 0;
/**
* Wait until we are signaled by a call to Set().
*/
virtual void Wait() = 0;
};
#endif /* THREAD_H */
|