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