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