repositories
/
deb_libcec.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4fe8d85
)
cec: make sure we're not trying to unlock the mutex too many times
author
Lars Op den Kamp
<lars@opdenkamp.eu>
Mon, 23 Jan 2012 18:30:12 +0000
(19:30 +0100)
committer
Lars Op den Kamp
<lars@opdenkamp.eu>
Mon, 23 Jan 2012 18:30:12 +0000
(19:30 +0100)
src/lib/platform/threads/mutex.h
patch
|
blob
|
blame
|
history
diff --git
a/src/lib/platform/threads/mutex.h
b/src/lib/platform/threads/mutex.h
index 4a2ad795f86e153cc59cb3c607e443198eecc735..2c2b5c569819a669353712c1968cfa14bab9cbae 100644
(file)
--- a/
src/lib/platform/threads/mutex.h
+++ b/
src/lib/platform/threads/mutex.h
@@
-81,8
+81,17
@@
namespace PLATFORM
inline void Unlock(void)
{
- --m_iLockCount;
- MutexUnlock(m_mutex);
+ if (Lock())
+ {
+ if (m_iLockCount >= 2)
+ {
+ --m_iLockCount;
+ MutexUnlock(m_mutex);
+ }
+
+ --m_iLockCount;
+ MutexUnlock(m_mutex);
+ }
}
inline bool Clear(void)
@@
-99,8
+108,8
@@
namespace PLATFORM
}
private:
- mutex_t m_mutex;
- unsigned int m_iLockCount;
+ mutex_t
m_mutex;
+
volatile
unsigned int m_iLockCount;
};
class CLockObject : public PreventCopy