[Libreoffice-commits] core.git: sal/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 13 13:12:21 UTC 2018
sal/qa/rtl/doublelock/rtl_doublelocking.cxx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit d140157952404d061c1e9df5c133d3ace735b73f
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Nov 13 09:25:42 2018 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Nov 13 14:11:59 2018 +0100
Fix race in test code
seen it fail at <https://ci.libreoffice.org/job/lo_tb_master_win/19591/>
> Value in Thread #1 is 0
> Value in Thread #2 is 0
> C:/cygwin/home/tdf/lode/jenkins/workspace/lo_tb_master_win/sal/qa/rtl/doublelock/rtl_doublelocking.cxx:199:rtl_DoubleLocking::getValue::getValue_002
> assertion failed
> - Expression: nValueOK != 0
> - getValue() failed, wrong value expected.
>
> rtl_DoubleLocking::getValue::getValue_002 finished in: 1267ms
Change-Id: I6ac85a9ff4da8c046412add40c9447ee53ef8d7e
Reviewed-on: https://gerrit.libreoffice.org/63320
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
index 1975057e33e3..cba75e99f728 100644
--- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
+++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
@@ -80,6 +80,7 @@ namespace ThreadHelper
*/
class OGetThread : public osl::Thread
{
+ osl::Mutex m_mutex;
sal_Int32 m_nOK;
sal_Int32 m_nFails;
@@ -92,8 +93,8 @@ public:
m_sConstStr = CONST_TEST_STRING;
}
- sal_Int32 getOK() { return m_nOK; }
- sal_Int32 getFails() {return m_nFails;}
+ sal_Int32 getOK() { osl::MutexGuard g(m_mutex); return m_nOK; }
+ sal_Int32 getFails() {osl::MutexGuard g(m_mutex); return m_nFails;}
protected:
@@ -108,10 +109,12 @@ protected:
OUString aStr = Gregorian::get();
if (aStr == m_sConstStr)
{
+ osl::MutexGuard g(m_mutex);
m_nOK++;
}
else
{
+ osl::MutexGuard g(m_mutex);
m_nFails++;
}
ThreadHelper::thread_sleep_tenth_sec(1);
More information about the Libreoffice-commits
mailing list