Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/cleanup/src/lib/util/threads/thread.h @ 10575

Last change on this file since 10575 was 10575, checked in by bensch, 17 years ago

simple threads splited up into multiple files

File size: 646 bytes
Line 
1#ifndef __THREAD_H__
2#define __THREAD_H__
3
4#ifdef HAVE_SDL_H
5#include <SDL_thread.h>
6#else
7#include <SDL/SDL_thread.h>
8#endif
9
10namespace OrxThread
11{
12  //! A class for Wrapping Threads
13  class Thread
14  {
15    public:
16      Thread(int (*fn)(void *), void *data) { this->thread = SDL_CreateThread(fn, data); };
17      virtual ~Thread() { SDL_KillThread(this->thread); }
18      void exit ( int returnCode = 0 );
19      bool isFinished () const;
20      bool isRunning () const;
21      void wait() { SDL_WaitThread(this->thread, NULL); };
22
23      void start();
24      void terminate();
25
26
27    private:
28      SDL_Thread* thread;
29
30  };
31
32#endif /* __THREAD_H__ */
Note: See TracBrowser for help on using the repository browser.