aboutsummaryrefslogtreecommitdiff
path: root/lib
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:15:20 +0100
commit5e05afa7dbc5acfc92a158dcc88b0be12c52af62 (patch)
treec5cea2c0bf01bf356fb43f914a1bef7ef1290690 /lib
parent7b46b591444685733d1fb3af5c814e0a93cf4d5f (diff)
downloadenigma2-5e05afa7dbc5acfc92a158dcc88b0be12c52af62.tar.gz
enigma2-5e05afa7dbc5acfc92a158dcc88b0be12c52af62.zip
elock.h: add possibility to create recursive mutexes
Diffstat (limited to 'lib')
-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()
{