Last change
on this file since 10765 was
10618,
checked in by bknecht, 18 years ago
|
merged cleanup into trunk (only improvements)
|
File size:
470 bytes
|
Line | |
---|
1 | #ifndef __MUTEX_LOCKER_H__ |
---|
2 | #define __MUTEX_LOCKER_H__ |
---|
3 | |
---|
4 | #include "mutex.h" |
---|
5 | |
---|
6 | namespace OrxThread |
---|
7 | { |
---|
8 | |
---|
9 | //! A Class that locks a Mutex within its scope |
---|
10 | class MutexLocker |
---|
11 | { |
---|
12 | public: |
---|
13 | //! Locks the Mutex mutex in this Scope. |
---|
14 | MutexLocker(Mutex* mutex) { SDL_mutexP(mutex->getMutex()); this->mutex = mutex; }; |
---|
15 | ~MutexLocker() { SDL_mutexV(mutex->getMutex()); }; |
---|
16 | private: |
---|
17 | Mutex* mutex; //!< The Mutex to lock. |
---|
18 | }; |
---|
19 | } |
---|
20 | |
---|
21 | #endif /* __MUTEX_LOCKER_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.