diff options
Diffstat (limited to 'src/mutex.h')
-rw-r--r-- | src/mutex.h | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/mutex.h b/src/mutex.h index 11704d4..4659a07 100644 --- a/src/mutex.h +++ b/src/mutex.h @@ -25,31 +25,35 @@ * along with Pracro; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef __PRACRO_MUTEX_H__ -#define __PRACRO_MUTEX_H__ +#pragma once struct mutex_private_t; class Mutex { public: - Mutex(); - ~Mutex(); + Mutex(); + ~Mutex(); - bool trylock(); - void lock(); - void unlock(); + bool try_lock(); + void lock(); + void unlock(); private: - struct mutex_private_t* prv; + struct mutex_private_t* prv; }; +#ifdef WIN32 +// Hack: mingw doesn't have std::mutex +namespace std { + class mutex : public Mutex {}; +} +#endif + class MutexAutolock { public: - MutexAutolock(Mutex &mutex); - ~MutexAutolock(); + MutexAutolock(Mutex &mutex); + ~MutexAutolock(); private: - Mutex &mutex; + Mutex &mutex; }; - -#endif/*__PRACRO_MUTEX_H__*/ |