summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-09-09 09:08:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-09 13:01:15 +0200
commit7b4b032daa2381e5c2f102d4e9619adf38968f94 (patch)
treed1aa06b33825a354bff4e16a3ab6ec0d2deada66 /vcl/win
parent542fb709a4c26c0e5be0c09c028dc86bdd419c6f (diff)
reduce time in ResetEvent (tdf#144052)
Change-Id: I3e9c906a026e7455fb775d110eca32f8533614e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121836 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/app/salinst.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index dd35317040d4..a34448884057 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -130,6 +130,11 @@ void SalYieldMutex::doAcquire( sal_uInt32 nLockCount )
// Window's create/destroy is called via SendMessage() from another thread.
// Have a look at the osl_waitCondition implementation for more info.
do {
+ // Calling Condition::reset frequently turns out to be a little expensive,
+ // and the vast majority of the time there is no contention, so first
+ // try just acquiring the mutex.
+ if (m_aMutex.tryToAcquire())
+ break;
// reset condition *before* acquiring!
m_condition.reset();
if (m_aMutex.tryToAcquire())