diff options
author | Viorel Munteanu <ceamac@gentoo.org> | 2022-12-19 20:51:12 +0200 |
---|---|---|
committer | Viorel Munteanu <ceamac@gentoo.org> | 2022-12-19 21:27:10 +0200 |
commit | a13a3325342f5ef87384302b272577725e659c7c (patch) | |
tree | bc9077cca40af9f2a9856e218cccb5a241f2c6b9 /dev-libs | |
parent | media-gfx/hugin: version bump (diff) | |
download | gentoo-a13a3325342f5ef87384302b272577725e659c7c.tar.gz gentoo-a13a3325342f5ef87384302b272577725e659c7c.tar.bz2 gentoo-a13a3325342f5ef87384302b272577725e659c7c.zip |
dev-libs/xalan-c: Fix threads test
The threads run and finish ok, but the counter used in the testing
application is not synchronized correctly; it seems the mutex they used
doesn't really work. So replace it by a std::mutex.
Closes: https://bugs.gentoo.org/887197
Closes: https://github.com/gentoo/gentoo/pull/28714
Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>
Diffstat (limited to 'dev-libs')
-rw-r--r-- | dev-libs/xalan-c/files/xalan-c-1.12-fix-threads.patch | 51 | ||||
-rw-r--r-- | dev-libs/xalan-c/xalan-c-1.12-r2.ebuild | 1 |
2 files changed, 52 insertions, 0 deletions
diff --git a/dev-libs/xalan-c/files/xalan-c-1.12-fix-threads.patch b/dev-libs/xalan-c/files/xalan-c-1.12-fix-threads.patch new file mode 100644 index 000000000000..4a8e0e582621 --- /dev/null +++ b/dev-libs/xalan-c/files/xalan-c-1.12-fix-threads.patch @@ -0,0 +1,51 @@ +xercesc::XMLMutex doesn't work, replace it by std::mutex +Bug: https://bugs.gentoo.org/887197 + +--- a/Tests/Threads/ThreadTest.cpp ++++ b/Tests/Threads/ThreadTest.cpp +@@ -49,6 +49,7 @@ + + #if defined(XALAN_USE_THREAD_STD) + #include <thread> ++#include <mutex> + #elif defined(XALAN_USE_THREAD_WINDOWS) + + #include <process.h> +@@ -95,8 +96,8 @@ + + + +-typedef xercesc::XMLMutex XMLMutexType; +-typedef xercesc::XMLMutexLock XMLMutexLockType; ++typedef std::mutex XMLMutexType; ++typedef std::lock_guard<std::mutex> XMLMutexLockType; + + + +@@ -121,7 +122,7 @@ + + XMLMutexType m_mutex; + +- long m_counter; ++ volatile long m_counter; + }; + + +@@ -143,7 +144,7 @@ + void + SynchronizedCounter::increment() + { +- const XMLMutexLockType theLock(&m_mutex); ++ const XMLMutexLockType theLock(m_mutex); + + if (m_counter < LONG_MAX) + { +@@ -156,7 +157,7 @@ + void + SynchronizedCounter::decrement() + { +- const XMLMutexLockType theLock(&m_mutex); ++ const XMLMutexLockType theLock(m_mutex); + + if (m_counter > 0) + { diff --git a/dev-libs/xalan-c/xalan-c-1.12-r2.ebuild b/dev-libs/xalan-c/xalan-c-1.12-r2.ebuild index cd8b913943ee..74e63f8e818f 100644 --- a/dev-libs/xalan-c/xalan-c-1.12-r2.ebuild +++ b/dev-libs/xalan-c/xalan-c-1.12-r2.ebuild @@ -43,6 +43,7 @@ BDEPEND+=" PATCHES=( "${FILESDIR}"/${P}-fix-lto.patch + "${FILESDIR}"/${P}-fix-threads.patch ) src_configure() { |