Browse Subversion Repository
Contents of /common/LockGuard.cpp
Parent Directory
| Revision Log
Revision 237 -
( show annotations)
( download)
( as text)
Mon Feb 11 21:51:26 2008 UTC
(16 years, 2 months ago)
by satofumi
File MIME type: text/x-c++src
File size: 595 byte(s)
debugging gui and gl_gui
| 1 |
/*! |
| 2 |
\file |
| 3 |
\brief SDL_mutex のロックガードクラス |
| 4 |
|
| 5 |
\author Satofumi KAMIMURA |
| 6 |
|
| 7 |
$Id$ |
| 8 |
*/ |
| 9 |
|
| 10 |
#include "LockGuard.h" |
| 11 |
|
| 12 |
using namespace beego; |
| 13 |
|
| 14 |
|
| 15 |
/*! |
| 16 |
\brief LockGuard の内部クラス |
| 17 |
*/ |
| 18 |
struct LockGuard::pImpl { |
| 19 |
SDL_mutex* mutex_; |
| 20 |
|
| 21 |
pImpl(SDL_mutex* mutex) : mutex_(mutex) { |
| 22 |
} |
| 23 |
}; |
| 24 |
|
| 25 |
|
| 26 |
LockGuard::LockGuard(SDL_mutex* mutex) : pimpl(new pImpl(mutex)) { |
| 27 |
SDL_LockMutex(pimpl->mutex_); |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
LockGuard::~LockGuard(void) { |
| 32 |
SDL_UnlockMutex(pimpl->mutex_); |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
void beego::LockMutex(SDL_mutex* mutex) { |
| 37 |
SDL_LockMutex(mutex); |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
void beego::UnlockMutex(SDL_mutex* mutex) { |
| 42 |
SDL_UnlockMutex(mutex); |
| 43 |
} |
|