Commit d25fd8d7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Timer: remove the static lock

parent 59fb10d0
...@@ -939,17 +939,17 @@ void vlc_timer_destroy (vlc_timer_t timer) ...@@ -939,17 +939,17 @@ void vlc_timer_destroy (vlc_timer_t timer)
void vlc_timer_schedule (vlc_timer_t timer, bool absolute, void vlc_timer_schedule (vlc_timer_t timer, bool absolute,
mtime_t value, mtime_t interval) mtime_t value, mtime_t interval)
{ {
static vlc_mutex_t lock = VLC_STATIC_MUTEX;
vlc_mutex_lock (&lock);
vlc_mutex_lock (&timer->lock); vlc_mutex_lock (&timer->lock);
if (timer->value) while (timer->value)
{ {
vlc_thread_t thread = timer->thread;
timer->value = 0;
vlc_mutex_unlock (&timer->lock); vlc_mutex_unlock (&timer->lock);
vlc_cancel (timer->thread); vlc_cancel (thread);
vlc_join (timer->thread, NULL); /* cannot keep the lock during vlc_join X( */
vlc_join (thread, NULL);
vlc_mutex_lock (&timer->lock); vlc_mutex_lock (&timer->lock);
timer->value = 0;
} }
if ((value != 0) if ((value != 0)
&& (vlc_clone (&timer->thread, vlc_timer_thread, timer, && (vlc_clone (&timer->thread, vlc_timer_thread, timer,
...@@ -959,7 +959,6 @@ void vlc_timer_schedule (vlc_timer_t timer, bool absolute, ...@@ -959,7 +959,6 @@ void vlc_timer_schedule (vlc_timer_t timer, bool absolute,
timer->interval = interval; timer->interval = interval;
} }
vlc_mutex_unlock (&timer->lock); vlc_mutex_unlock (&timer->lock);
vlc_mutex_unlock (&lock);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment