123456789101112131415161718192021222324252627282930313233343536 |
- #ifndef THREAD_H
- #define THREAD_H
- #include <iostream>
- #include <map>
- #include <SDL/SDL_thread.h>
- class Thread
- {
- public:
- Thread();
- virtual ~Thread();
- bool start();
- void stop();
- void join();
- void setAutoDelete(bool autoDelete);
- bool threadRunning();
- bool lockMutex(std::string name);
- bool unlockMutex(std::string name);
- virtual void run() = 0;
- protected:
- bool createLockMutex(std::string name);
- private:
- static int ThreadInit(void* param);
- bool m_isstop;
- SDL_Thread *m_t;
- bool m_autoDelete;
- std::map<std::string, SDL_mutex*> m_mutexs;
- };
- #endif
|