5 #ifndef BALL_SYSTEM_MUTEX_H
6 #define BALL_SYSTEM_MUTEX_H
8 #ifndef BALL_COMMON_GLOBAL_H
12 #include <QtCore/QMutex>
13 #include <QtCore/QReadWriteLock>
14 #include <QtCore/QMutexLocker>
15 #include <QtCore/QReadLocker>
16 #include <QtCore/QWriteLocker>
18 #include <boost/thread/mutex.hpp>
20 #undef BALL_USE_THREAD_CHECKER_API
21 #ifdef BALL_USE_THREAD_CHECKER_API
22 # include <libittnotify.h>
25 #define BALL_DEFAULT_MUTEX_TYPE QMutex
26 #define BALL_DEFAULT_MUTEXLOCKER_TYPE QMutexLocker
27 #define BALL_DEFAULT_READWRITELOCK_TYPE QReadWriteLock
28 #define BALL_DEFAULT_READLOCKER_TYPE QReadLocker
29 #define BALL_DEFAULT_WRITELOCKER_TYPE QWriteLocker
40 template <
class MutexType>
56 : QMutex( is_recursive ? Recursive : NonRecursive )
71 template <
class MutexLockerType,
class MutexType>
89 template <
class ReadWriteLockType>
101 :
public QReadWriteLock
105 : QReadWriteLock( is_recursive ? Recursive : NonRecursive )
119 template <
class ReadLockerType,
class ReadWriteLockType>
139 template <
class WriteLockerType,
class ReadWriteLockType>
153 :
public boost::mutex
162 return boost::mutex::lock();
172 #ifdef BALL_USE_THREAD_CHECKER_API
185 __itt_notify_sync_prepare((
void *)
this);
187 __itt_notify_sync_acquired((
void*)
this);
192 __itt_notify_sync_releasing((
void *)
this);
198 __itt_notify_sync_prepare((
void*)
this);
199 bool result = QMutex::tryLock();
202 __itt_notify_sync_acquired((
void*)
this);
204 __itt_notify_sync_cancel((
void*)
this);
214 #ifdef BALL_COMPILER_MSVC
217 template class BALL_EXPORT TMutexLocker<BALL_DEFAULT_MUTEXLOCKER_TYPE, BALL_DEFAULT_MUTEX_TYPE>;
218 template class BALL_EXPORT TReadLocker<BALL_DEFAULT_READLOCKER_TYPE, BALL_DEFAULT_READWRITELOCK_TYPE>;
219 template class BALL_EXPORT TWriteLocker<BALL_DEFAULT_WRITELOCKER_TYPE, BALL_DEFAULT_READWRITELOCK_TYPE>;
231 #endif // BALL_SYSTEM_MUTEX_H