diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-01-27 01:05:05 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-01-27 01:05:05 +0000 |
| commit | 8fc0752931ad7a8efa802b0a0f0246a2b50eca6b (patch) | |
| tree | 2dcf004cd57c89915779653817058d4d2e8830e9 /lib/base/elock.h | |
| parent | a2705e2beab9649b7ad70d0873aba014778e5d20 (diff) | |
| download | enigma2-8fc0752931ad7a8efa802b0a0f0246a2b50eca6b.tar.gz enigma2-8fc0752931ad7a8efa802b0a0f0246a2b50eca6b.zip | |
fix locking in dvb file player
Diffstat (limited to 'lib/base/elock.h')
| -rw-r--r-- | lib/base/elock.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/base/elock.h b/lib/base/elock.h index 6a47f8c9..f886473b 100644 --- a/lib/base/elock.h +++ b/lib/base/elock.h @@ -7,7 +7,7 @@ class singleLock { pthread_mutex_t &lock; public: - singleLock( pthread_mutex_t &m ) + singleLock(pthread_mutex_t &m ) :lock(m) { pthread_mutex_lock(&lock); @@ -18,6 +18,36 @@ public: } }; +class eSingleLock +{ + friend class eSingleLocker; + pthread_mutex_t m_lock; +public: + eSingleLock() + { + pthread_mutex_init(&m_lock, 0); + } + ~eSingleLock() + { + pthread_mutex_destroy(&m_lock); + } +}; + +class eSingleLocker +{ + eSingleLock &m_lock; +public: + eSingleLocker(eSingleLock &m) + : m_lock(m) + { + pthread_mutex_lock(&m_lock.m_lock); + } + ~eSingleLocker() + { + pthread_mutex_unlock(&m_lock.m_lock); + } +}; + class eLock { pthread_mutex_t mutex; |
