forked from jsonn/pkgsrc
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SingleLock.h Do not create copy of CCriticalSection for each CSingleLock instance Use reference to CCriticalSection as a CSingleLock member. Otherwise assignment operator just byte-copies content of CCriticalSection and for each copy destructor will destroy mutex which may lead to undefined behaviour OMXThread.cpp Fix order of operations on pthread attribute: init first, then modify Bump PKGREVISION
- Loading branch information
skrll
committed
Nov 13, 2015
1 parent
e60fe40
commit cace866
Showing
4 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
$NetBSD: patch-OMXThread.cpp,v 1.1 2015/11/13 15:12:15 skrll Exp $ | ||
|
||
--- OMXThread.cpp.orig 2015-01-12 15:10:50.000000000 +0000 | ||
+++ OMXThread.cpp | ||
@@ -41,8 +41,8 @@ | ||
OMXThread::OMXThread() | ||
{ | ||
pthread_mutex_init(&m_lock, NULL); | ||
- pthread_attr_setdetachstate(&m_tattr, PTHREAD_CREATE_JOINABLE); | ||
pthread_attr_init(&m_tattr); | ||
+ pthread_attr_setdetachstate(&m_tattr, PTHREAD_CREATE_JOINABLE); | ||
m_thread = 0; | ||
m_bStop = false; | ||
m_running = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
$NetBSD: patch-utils_SingleLock.h,v 1.1 2015/11/13 15:12:15 skrll Exp $ | ||
|
||
--- utils/SingleLock.h.orig 2015-01-12 15:10:50.000000000 +0000 | ||
+++ utils/SingleLock.h | ||
@@ -40,6 +40,10 @@ public: | ||
inline void Lock() { pthread_mutex_lock(&m_lock); } | ||
inline void Unlock() { pthread_mutex_unlock(&m_lock); } | ||
|
||
+private: | ||
+ CCriticalSection(CCriticalSection &other) = delete; | ||
+ CCriticalSection& operator=(const CCriticalSection&) = delete; | ||
+ | ||
protected: | ||
pthread_mutex_t m_lock; | ||
}; | ||
@@ -48,11 +52,11 @@ protected: | ||
class CSingleLock | ||
{ | ||
public: | ||
- inline CSingleLock(CCriticalSection& cs) { m_section = cs; m_section.Lock(); } | ||
+ inline CSingleLock(CCriticalSection& cs) : m_section(cs) { m_section.Lock(); } | ||
inline ~CSingleLock() { m_section.Unlock(); } | ||
|
||
protected: | ||
- CCriticalSection m_section; | ||
+ CCriticalSection &m_section; | ||
}; | ||
|
||
|