• Michael Stahl's avatar
    vcl: fix hangs in SvpSalInstance · 0efd06de
    Michael Stahl yazdı
    Since commit cb8bfa9a the main thread
    will read from the timer pipe until it is empty. But evidently this
    introduces the problem that the poll() in another thread will not
    return, as the file descriptor will no longer be readable; see
    https://paste.debian.net/1011306/ for a reproducer of that rather
    under-documented poll behaviour.  So other threads can get stuck
    forever in poll, and then the main thread can block in poll too with
    no other thread to wake it up.  This is the problem that plagues
    UITest_writerperfect_epubexport.
    
    The timer pipe is difficult to fix, since the main thread can block on
    either the poll or the subsequent AcquireYieldMutex().
    
    So replace the timer pipe with a condition etc. that is mostly
    copied from the OSX AquaSalInstance/SalYieldMutex implementation.
    
    The main thread now does something different than the other threads,
    and blocks on a condition_variable with a timeout, while other
    threads still block on acquiring the mutex.
    
    Non-main threads can poke the main thread to do a DoYield()
    on their behalf, and then get the result back with a blocking
    read from a pipe, all while holding the YieldMutex.  This
    requires some fudging of the YieldMutex so that the main
    thread can borrow the ownership temporarily.
    
    Unfortunately SvpSalInstance, in addition to being directly
    instantiable for --headless, has a whole bunch of subclasses:
    
    * HeadlessSalInstance
    * AndroidSalInstance
    * IosSalInstance
    * GtkInstance (in the gtk3 case)
    * KDE5SalInstance
    
    Of these GtkInstance overrides everything related to the
    DoYield/SalYieldMutex implementation, but the others will be
    affected by the change.
    
    This commit will probably break IOS due to me not understanding the
    point of the undocumented random #ifdef IOS in svpinst.cxx.
    
    Change-Id: I1bbb143952dda89579e97ac32cd147e5b987573c
    Reviewed-on: https://gerrit.libreoffice.org/50237Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
    0efd06de
Adı
Son kayıt (commit)
Son güncelleme
..
androidinst.cxx Loading commit data...