add possibility to enable recursive mutex support for pthread
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@828 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
b2ad60ebe7
commit
5e2237dcb0
2 changed files with 22 additions and 9 deletions
17
CHANGES
17
CHANGES
|
@ -5,11 +5,14 @@ Version 0.1.7
|
||||||
_____________________________________
|
_____________________________________
|
||||||
|
|
||||||
General:
|
General:
|
||||||
- Fixed makefiles for GNU/kFreeBSD, GNU/hurd (lf)
|
- Fixed makefiles for GNU/kFreeBSD, GNU/hurd (lf)
|
||||||
- Fixed build errors with gcc 4.3 pre-release (lf)
|
- Fixed build errors with gcc 4.3 pre-release (lf)
|
||||||
- Fixed compiler error that occurs when using 64 bit pointers (rs)
|
- Fixed compiler error that occurs when using 64 bit pointers (rs)
|
||||||
- Added more unit tests (rs)
|
- Added more unit tests (rs)
|
||||||
- Several other bug fixes (rs, pk)
|
- Several other bug fixes (rs, pk)
|
||||||
|
|
||||||
|
Threads:
|
||||||
|
- add possibility to enable recursive mutex support for pthread (pk)
|
||||||
|
|
||||||
CVS commits by Lukas Fittl (lf), Peter Kümmel (pk), Rich Sposato (rs)
|
CVS commits by Lukas Fittl (lf), Peter Kümmel (pk), Rich Sposato (rs)
|
||||||
|
|
||||||
|
@ -20,8 +23,8 @@ February 25, 2007
|
||||||
_____________________________________
|
_____________________________________
|
||||||
|
|
||||||
General:
|
General:
|
||||||
- CacheFactory added by Guillaume Chatelet
|
- CacheFactory added by Guillaume Chatelet
|
||||||
- Factory documentation improved by Guillaume Chatelet
|
- Factory documentation improved by Guillaume Chatelet
|
||||||
- migrated to subversion (pk)
|
- migrated to subversion (pk)
|
||||||
- Mac linker errors fixed (lf)
|
- Mac linker errors fixed (lf)
|
||||||
- Makefiles can now be called from sub directories (lf)
|
- Makefiles can now be called from sub directories (lf)
|
||||||
|
|
|
@ -89,6 +89,7 @@
|
||||||
#define LOKI_THREADS_MUTEX_LOCK(x) ::EnterCriticalSection (x)
|
#define LOKI_THREADS_MUTEX_LOCK(x) ::EnterCriticalSection (x)
|
||||||
#define LOKI_THREADS_MUTEX_UNLOCK(x) ::LeaveCriticalSection (x)
|
#define LOKI_THREADS_MUTEX_UNLOCK(x) ::LeaveCriticalSection (x)
|
||||||
#define LOKI_THREADS_LONG LONG
|
#define LOKI_THREADS_LONG LONG
|
||||||
|
#define LOKI_THREADS_MUTEX_CTOR(x)
|
||||||
|
|
||||||
#define LOKI_THREADS_ATOMIC_FUNCTIONS \
|
#define LOKI_THREADS_ATOMIC_FUNCTIONS \
|
||||||
static IntType AtomicIncrement(volatile IntType& lval) \
|
static IntType AtomicIncrement(volatile IntType& lval) \
|
||||||
|
@ -110,9 +111,17 @@
|
||||||
|
|
||||||
#define LOKI_THREADS_MUTEX(x) pthread_mutex_t (x);
|
#define LOKI_THREADS_MUTEX(x) pthread_mutex_t (x);
|
||||||
|
|
||||||
// no recursive mutex support
|
|
||||||
#define LOKI_THREADS_MUTEX_INIT(x) ::pthread_mutex_init(x, 0)
|
#define LOKI_THREADS_MUTEX_INIT(x) ::pthread_mutex_init(x, 0)
|
||||||
|
|
||||||
|
// define to 1 to enable recursive mutex support
|
||||||
|
#if 0
|
||||||
|
// experimental recursive mutex support
|
||||||
|
#define LOKI_THREADS_MUTEX_CTOR(x) : x(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
|
||||||
|
#else
|
||||||
|
// no recursive mutex support
|
||||||
|
#define LOKI_THREADS_MUTEX_CTOR(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOKI_THREADS_MUTEX_DELETE(x) ::pthread_mutex_destroy (x)
|
#define LOKI_THREADS_MUTEX_DELETE(x) ::pthread_mutex_destroy (x)
|
||||||
#define LOKI_THREADS_MUTEX_LOCK(x) ::pthread_mutex_lock (x)
|
#define LOKI_THREADS_MUTEX_LOCK(x) ::pthread_mutex_lock (x)
|
||||||
#define LOKI_THREADS_MUTEX_UNLOCK(x) ::pthread_mutex_unlock (x)
|
#define LOKI_THREADS_MUTEX_UNLOCK(x) ::pthread_mutex_unlock (x)
|
||||||
|
@ -147,6 +156,7 @@
|
||||||
#define LOKI_THREADS_MUTEX_LOCK(x)
|
#define LOKI_THREADS_MUTEX_LOCK(x)
|
||||||
#define LOKI_THREADS_MUTEX_UNLOCK(x)
|
#define LOKI_THREADS_MUTEX_UNLOCK(x)
|
||||||
#define LOKI_THREADS_LONG
|
#define LOKI_THREADS_LONG
|
||||||
|
#define LOKI_THREADS_MUTEX_CTOR(x)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -165,7 +175,7 @@ namespace Loki
|
||||||
class Mutex
|
class Mutex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Mutex()
|
Mutex() LOKI_THREADS_MUTEX_CTOR(mtx_)
|
||||||
{
|
{
|
||||||
LOKI_THREADS_MUTEX_INIT(&mtx_);
|
LOKI_THREADS_MUTEX_INIT(&mtx_);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue