[vlc-devel] [PATCH] timer: add a few explicit cancellation points
Sean McGovern
gseanmcg at gmail.com
Mon Aug 18 23:48:21 CEST 2014
---
I highly suspect this patch is JustPlainWrong, but it does
"fix" the catatonic thread problem on newer versions of
OS X. Comments welcome.
---
src/posix/timer.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/posix/timer.c b/src/posix/timer.c
index 71ca080..cd2ca63 100644
--- a/src/posix/timer.c
+++ b/src/posix/timer.c
@@ -59,12 +59,17 @@ static void *vlc_timer_thread (void *data)
for (;;)
{
- while (timer->value == 0)
+ vlc_testcancel();
+ while (timer->value == 0) {
vlc_cond_wait (&timer->reschedule, &timer->lock);
+ vlc_testcancel();
+ }
if (vlc_cond_timedwait (&timer->reschedule, &timer->lock,
- timer->value) == 0)
+ timer->value) == 0) {
+ vlc_testcancel();
continue;
+ }
if (timer->interval == 0)
timer->value = 0; /* disarm */
vlc_mutex_unlock (&timer->lock);
@@ -149,6 +154,7 @@ int vlc_timer_create (vlc_timer_t *id, void (*func) (void *), void *data)
void vlc_timer_destroy (vlc_timer_t timer)
{
vlc_cancel (timer->thread);
+ vlc_cond_broadcast(&timer->reschedule);
vlc_join (timer->thread, NULL);
vlc_cond_destroy (&timer->reschedule);
vlc_mutex_destroy (&timer->lock);
--
1.8.5.2 (Apple Git-48)
More information about the vlc-devel
mailing list