diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-03-23 00:44:50 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-03-29 03:01:30 +0100 |
commit | 22f5afb78aeaf6e5e9a4fb00d74833d73cef5bbc (patch) | |
tree | a673f11eee1cf10b4136303b905c6e47d277ac0e /vcl | |
parent | d757b121e3f0f5de03da1be430ed51bf830dce67 (diff) |
GTK use SalYieldMutex lock arguments
The acquire and release functions already provide arguments to
release and re-acquire the lock, so use these. Also moves the
n-1 lock handling from release into acquire. This way release
doesn't need any special handling, which acquire already does.
Change-Id: If2fc92beb8e3ea1f5c078da4d8dde3ce9c774c6f
Reviewed-on: https://gerrit.libreoffice.org/69574
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk/gtkinst.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx index 64604ea3f92a..f18dc9457fd5 100644 --- a/vcl/unx/gtk/gtkinst.cxx +++ b/vcl/unx/gtk/gtkinst.cxx @@ -313,20 +313,18 @@ void GtkYieldMutex::ThreadsEnter() if (!yieldCounts.empty()) { auto n = yieldCounts.top(); yieldCounts.pop(); - for (; n != 0; --n) { - acquire(); - } + assert(n > 0); + n--; + if (n > 0) + acquire(n); } } void GtkYieldMutex::ThreadsLeave() { assert(m_nCount != 0); - auto n = m_nCount - 1; - yieldCounts.push(n); - for (sal_uIntPtr i = 0; i != n + 1; ++i) { - release(); - } + yieldCounts.push(m_nCount); + release(true); } std::unique_ptr<SalVirtualDevice> GtkInstance::CreateVirtualDevice( SalGraphics *pG, |