| Last change
                  on this file since 7509 was
                  7331,
                  checked in by bensch, 20 years ago | 
        
          | 
orxonox/trunk: small improved functoid
 | 
        | File size:
            714 bytes | 
      
      
        
  | Line |  | 
|---|
| 1 | /*! | 
|---|
| 2 | * @file threading.h | 
|---|
| 3 | * @brief Definition of Thread Classes. | 
|---|
| 4 | * | 
|---|
| 5 | * These are mainly Classes, that are used for wrapping around SDL_thread | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef _THREADING_H | 
|---|
| 9 | #define _THREADING_H | 
|---|
| 10 |  | 
|---|
| 11 | #ifdef HAVE_SDL_H | 
|---|
| 12 | #include <SDL_thread.h> | 
|---|
| 13 | #else | 
|---|
| 14 | #include <SDL/SDL_thread.h> | 
|---|
| 15 | #endif | 
|---|
| 16 |  | 
|---|
| 17 |  | 
|---|
| 18 | //! A class for Wrapping Threads | 
|---|
| 19 | class Threading | 
|---|
| 20 | { | 
|---|
| 21 |  | 
|---|
| 22 | public: | 
|---|
| 23 | Threading(); | 
|---|
| 24 | virtual ~Threading(); | 
|---|
| 25 |  | 
|---|
| 26 |  | 
|---|
| 27 | private: | 
|---|
| 28 |  | 
|---|
| 29 | }; | 
|---|
| 30 |  | 
|---|
| 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 | }; | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 | #endif /* _THREADING_H */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.