Changeset 7737 in orxonox.OLD for trunk/src/lib/util
- Timestamp:
- May 19, 2006, 11:38:34 PM (19 years ago)
- Location:
- trunk/src/lib/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/threading.cc
r7329 r7737 20 20 using namespace std; 21 21 22 namespace OrxThread 23 { 22 24 23 25 /** … … 25 27 * @todo this constructor is not jet implemented - do it 26 28 */ 27 Thread ing::Threading()29 Thread::Thread() 28 30 { 29 31 } … … 33 35 * standard deconstructor 34 36 */ 35 Thread ing::~Threading()37 Thread::~Thread() 36 38 { 37 39 // delete what has to be deleted here 38 40 } 41 42 } -
trunk/src/lib/util/threading.h
r7331 r7737 15 15 #endif 16 16 17 namespace OrxThread 18 { 19 //! A class for Wrapping Threads 20 class Thread 21 { 17 22 18 //! A class for Wrapping Threads 19 class Threading 20 { 21 22 public: 23 Threading(); 24 virtual ~Threading(); 23 public: 24 Thread(); 25 virtual ~Thread(); 25 26 26 27 27 private:28 private: 28 29 29 };30 }; 30 31 31 //! A Class that locks a Mutex within its scope 32 class MutexLock 33 { 34 public: 35 //! Locks the Mutex mutex in this Scope. 36 MutexLock(SDL_mutex* mutex) { SDL_mutexP(mutex); this->mutex = mutex; }; 37 ~MutexLock() { SDL_mutexV(mutex); }; 38 private: 39 SDL_mutex* mutex; //!< The Mutex to lock. 40 }; 32 class Mutex 33 { 34 public: 35 Mutex() { this->mutex = SDL_CreateMutex(); }; 36 ~Mutex() { SDL_DestroyMutex(this->mutex); } 41 37 38 void lock() { SDL_mutexP(mutex); }; 39 void unlock() { SDL_mutexV(mutex); }; 40 41 SDL_mutex* getMutex() const { return this->mutex; }; 42 private: 43 SDL_mutex* mutex; 44 }; 45 46 //! A Class that locks a Mutex within its scope 47 class MutexLock 48 { 49 public: 50 //! Locks the Mutex mutex in this Scope. 51 MutexLock(Mutex* mutex) { SDL_mutexP(mutex->getMutex()); this->mutex = mutex; }; 52 ~MutexLock() { SDL_mutexV(mutex->getMutex()); }; 53 private: 54 Mutex* mutex; //!< The Mutex to lock. 55 }; 56 } 42 57 43 58 #endif /* _THREADING_H */
Note: See TracChangeset
for help on using the changeset viewer.