aboutsummaryrefslogtreecommitdiff
path: root/lib/base
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2009-12-17 14:46:04 +0100
committerghost <andreas.monzner@multimedia-labs.de>2009-12-17 15:23:07 +0100
commit8b4017d003a6d7ed074212a8f335707080eace6a (patch)
treeef42e2965c93078270dfd542c7666fe7abeb4be3 /lib/base
parent7373f39fe2ebe1b5007ed56ddd86d9ce0ad3efb7 (diff)
downloadenigma2-8b4017d003a6d7ed074212a8f335707080eace6a.tar.gz
enigma2-8b4017d003a6d7ed074212a8f335707080eace6a.zip
elock.h: add possibility to create recursive mutexes
Diffstat (limited to 'lib/base')
-rw-r--r--lib/base/elock.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/base/elock.h b/lib/base/elock.h
index 51582e67..01757182 100644
--- a/lib/base/elock.h
+++ b/lib/base/elock.h
@@ -83,9 +83,18 @@ class eSingleLock
pthread_mutex_t m_lock;
eSingleLock(eSingleLock &);
public:
- eSingleLock()
+ eSingleLock(bool recursive=false)
{
- pthread_mutex_init(&m_lock, 0);
+ if (recursive)
+ {
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&m_lock, &attr);
+ pthread_mutexattr_destroy(&attr);
+ }
+ else
+ pthread_mutex_init(&m_lock, 0);
}
~eSingleLock()
{