View | Details | Raw Unified | Return to bug 214473 | Differences between
and this patch

Collapse All | Expand All

(-)vcl/unx/gtk/gtkinst.cxx (-10 / +11 lines)
Lines 298-325 SalPrinter* GtkInstance::CreatePrinter( Link Here
298
 * for each pair, so we can accurately restore
298
 * for each pair, so we can accurately restore
299
 * it later.
299
 * it later.
300
 */
300
 */
301
thread_local std::stack<sal_uIntPtr> GtkYieldMutex::yieldCounts;
302
301
303
void GtkYieldMutex::ThreadsEnter()
302
void GtkYieldMutex::ThreadsEnter()
304
{
303
{
305
    acquire();
304
    acquire();
306
    if (!yieldCounts.empty()) {
305
    if( !aYieldStack.empty() )
307
        auto n = yieldCounts.top();
306
    { /* Previously called ThreadsLeave() */
308
        yieldCounts.pop();
307
        sal_uLong nCount = aYieldStack.front();
309
        for (; n != 0; --n) {
308
        aYieldStack.pop_front();
309
        while( nCount-- > 1 )
310
            acquire();
310
            acquire();
311
        }
312
    }
311
    }
313
}
312
}
314
313
315
void GtkYieldMutex::ThreadsLeave()
314
void GtkYieldMutex::ThreadsLeave()
316
{
315
{
316
    aYieldStack.push_front( mnCount );
317
    assert(mnCount != 0);
317
    assert(mnCount != 0);
318
    auto n = mnCount - 1;
318
    SAL_WARN_IF(
319
    yieldCounts.push(n);
319
        mnThreadId && mnThreadId != osl::Thread::getCurrentIdentifier(),
320
    for (sal_uIntPtr i = 0; i != n + 1; ++i) {
320
        "vcl.gtk", "other thread " << mnThreadId << " owns the mutex");
321
    while( mnCount > 1 )
321
        release();
322
        release();
322
    }
323
    release();
323
}
324
}
324
325
325
SalVirtualDevice* GtkInstance::CreateVirtualDevice( SalGraphics *pG,
326
SalVirtualDevice* GtkInstance::CreateVirtualDevice( SalGraphics *pG,

Return to bug 214473