• Rémi Denis-Courmont's avatar
    interrupt: add support for custom callbacks · 9ee0adc8
    Rémi Denis-Courmont authored
    It seems impossible to handle interruptions while waiting on a
    condition variable otherwise.
    In particular, a single vlc_cond_wait_i11e() function would be
    intrinsically prone to deadlocks:
     - It would need to acquire the interrupt context lock while the caller
       already holds the mutex corresponding to the condition variable, but
     - the interrupt callback would need to acquire the mutex while holding
       the interrupt context lock.
    This would be a classic lock inversion race.
    This addition should also enable hooking with other libraries, such as
    Glib´s GCancellable.
    Be very careful when using these two new functions. VLC does not
    support stacking interrupt handlers (at least not currently). So there
    MUST NOT be any call to another interruptible function between
    vlc_interrupt_register() and vlc_interrupt_unregister().
vlc_interrupt.h 7.5 KB