Changeset 10576 in orxonox.OLD for branches/cleanup/src/lib/util
- Timestamp:
- Feb 7, 2007, 9:28:52 PM (18 years ago)
- Location:
- branches/cleanup/src/lib/util/threads
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cleanup/src/lib/util/threads/mutex.h
r10574 r10576 1 1 #ifndef __MUTEX_H__ 2 2 #define __MUTEX_H__ 3 4 class Mutex 3 4 5 #include "threadincl.h" 6 namespace OrxThread 5 7 { 8 9 class Mutex 10 { 6 11 public: 7 12 Mutex() { this->mutex = SDL_CreateMutex(); }; … … 14 19 private: 15 20 SDL_mutex* mutex; 16 };17 21 }; 22 } 18 23 #endif /* __MUTEX_H__ */ -
branches/cleanup/src/lib/util/threads/mutex_locker.h
r10574 r10576 1 1 #ifndef __MUTEX_LOCKER_H__ 2 2 #define __MUTEX_LOCKER_H__ 3 //! A Class that locks a Mutex within its scope 4 class MutexLock 3 4 #include "mutex.h" 5 6 namespace OrxThread 5 7 { 8 9 //! A Class that locks a Mutex within its scope 10 class MutexLock 11 { 6 12 public: 7 13 //! Locks the Mutex mutex in this Scope. … … 10 16 private: 11 17 Mutex* mutex; //!< The Mutex to lock. 12 };18 }; 13 19 } 14 20 -
branches/cleanup/src/lib/util/threads/thread.cc
r10575 r10576 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2004 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: ... … … 16 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 17 17 18 #include "thread ing.h"18 #include "thread.h" 19 19 20 20 21 21 22 22 namespace OrxThread 23 23 { 24 24 25 /**26 * standard constructor27 * @todo this constructor is not jet implemented - do it28 */29 // Thread::Thread()30 // {31 // }25 /** 26 * standard constructor 27 * @todo this constructor is not jet implemented - do it 28 */ 29 // Thread::Thread() 30 // { 31 // } 32 32 33 33 34 /**35 * standard deconstructor36 */37 // Thread::~Thread()38 // {39 // // delete what has to be deleted here40 // }34 /** 35 * standard deconstructor 36 */ 37 // Thread::~Thread() 38 // { 39 // // delete what has to be deleted here 40 // } 41 41 42 42 } -
branches/cleanup/src/lib/util/threads/thread.h
r10575 r10576 2 2 #define __THREAD_H__ 3 3 4 #ifdef HAVE_SDL_H 5 #include <SDL_thread.h> 6 #else 7 #include <SDL/SDL_thread.h> 8 #endif 4 #include "threadincl.h" 9 5 10 6 namespace OrxThread … … 13 9 class Thread 14 10 { 15 16 17 18 19 20 21 11 public: 12 Thread(int (*fn)(void *), void *data) { this->thread = SDL_CreateThread(fn, data); }; 13 virtual ~Thread() { SDL_KillThread(this->thread); } 14 void exit ( int returnCode = 0 ); 15 bool isFinished () const; 16 bool isRunning () const; 17 void wait() { SDL_WaitThread(this->thread, NULL); }; 22 18 23 24 19 void start(); 20 void terminate(); 25 21 26 22 27 28 23 private: 24 SDL_Thread* thread; 29 25 30 26 }; 27 } 31 28 32 29 #endif /* __THREAD_H__ */
Note: See TracChangeset
for help on using the changeset viewer.