3 This file is part of libmspcore
4 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_CORE_THREAD_H_
9 #define MSP_CORE_THREAD_H_
16 Base class for threads. To create a thread for some task, derive it from this
17 class and implement the main() function. Note that threads are not
18 automatically started upon creation - you must manually call launch() instead.
19 This is to allow initializing variables of the derived class before the thread
29 Thread(): launched_(false) { }
38 virtual void main()=0;
48 main_(void *t) { (reinterpret_cast<Thread *>(t))->main(); return 0; }
50 Thread(const Thread &);
51 Thread &operator=(const Thread &);