diff options
author | Simon Farnsworth <simon.farnsworth@onelan.co.uk> | 2007-07-13 15:41:12 +0100 |
---|---|---|
committer | Simon Farnsworth <simon.farnsworth@onelan.co.uk> | 2007-07-13 15:41:12 +0100 |
commit | c29f5163db85b1b4097a791ca1ba96f2b52f1f04 (patch) | |
tree | 2f26e2a1ef4476387bd8ea6f1ebbbed16f02ec0d /src/xine-engine/xine_internal.h | |
parent | 1e39505760d7c54d3a435a47b1ffb05e204f8057 (diff) | |
download | xine-lib-c29f5163db85b1b4097a791ca1ba96f2b52f1f04.tar.gz xine-lib-c29f5163db85b1b4097a791ca1ba96f2b52f1f04.tar.bz2 |
Prevent ticket system deadlock when using DVB subtitles
When using DVB subtitles on an SMP machine, we see occasional lockups, which
appear to be caused by one thread acquiring the same ticket twice. Fix this,
by preventing acquire() and release() from blocking if the current thread has
already acquired the ticket.
Code sequences like the following can still block in all acquires and
releases:
ticket->acquire(...)
/* Do something */
ticket->release(...)
However, code sequences like the following, which used to deadlock if ticket
was revoked at just the wrong moment, now succeed:
ticket->acquire(...)
/* Do something */
ticket->acquire(...) /* This acquire cannot block */
/* Do something */
ticket->release(...) /* This release cannot block */
/* Do something */
ticket->release(...)
Without this patch, the inner acquire() and release() calls could block if
ticket was revoked at the wrong time. revoke() would not unblock the blocking
acquire until there have been as many release()s as acquire()s, which cannot
happen.
Diffstat (limited to 'src/xine-engine/xine_internal.h')
-rw-r--r-- | src/xine-engine/xine_internal.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 5f9a82f97..5523001ca 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -75,6 +75,7 @@ extern "C" { #define XINE_MAX_EVENT_LISTENERS 50 #define XINE_MAX_EVENT_TYPES 100 +#define XINE_MAX_TICKET_HOLDER_THREADS 64 /* used by plugin loader */ #define XINE_VERSION_CODE XINE_MAJOR_VERSION*10000+XINE_MINOR_VERSION*100+XINE_SUB_VERSION @@ -179,6 +180,11 @@ struct xine_ticket_s { int pending_revocations; int atomic_revoke; pthread_t atomic_revoker_thread; + struct { + int count; + pthread_t holder; + } *holder_threads; + unsigned holder_thread_count; #endif }; |