Kaydet (Commit) 22f5afb7 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

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: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
üst d757b121
...@@ -313,20 +313,18 @@ void GtkYieldMutex::ThreadsEnter() ...@@ -313,20 +313,18 @@ void GtkYieldMutex::ThreadsEnter()
if (!yieldCounts.empty()) { if (!yieldCounts.empty()) {
auto n = yieldCounts.top(); auto n = yieldCounts.top();
yieldCounts.pop(); yieldCounts.pop();
for (; n != 0; --n) { assert(n > 0);
acquire(); n--;
} if (n > 0)
acquire(n);
} }
} }
void GtkYieldMutex::ThreadsLeave() void GtkYieldMutex::ThreadsLeave()
{ {
assert(m_nCount != 0); assert(m_nCount != 0);
auto n = m_nCount - 1; yieldCounts.push(m_nCount);
yieldCounts.push(n); release(true);
for (sal_uIntPtr i = 0; i != n + 1; ++i) {
release();
}
} }
std::unique_ptr<SalVirtualDevice> GtkInstance::CreateVirtualDevice( SalGraphics *pG, std::unique_ptr<SalVirtualDevice> GtkInstance::CreateVirtualDevice( SalGraphics *pG,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment