git.cweiske.de
/
enigma2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7b46b59
)
elock.h: add possibility to create recursive mutexes
author
ghost
<andreas.monzner@multimedia-labs.de>
Thu, 17 Dec 2009 13:46:04 +0000
(14:46 +0100)
committer
ghost
<andreas.monzner@multimedia-labs.de>
Thu, 17 Dec 2009 14:15:20 +0000
(15:15 +0100)
lib/base/elock.h
patch
|
blob
|
history
diff --git
a/lib/base/elock.h
b/lib/base/elock.h
index 51582e67fe5a3d6e97ba97c82856c4bcd3127019..01757182a06a7dc4166421a91a6a5990e3844004 100644
(file)
--- 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()
{