[vlc-devel] commit: libvlc: Make sure no event will be send after _detach from the asynch thread. ( Pierre d'Herbemont )

Laurent Aimar fenrir at via.ecp.fr
Thu Jun 4 09:29:38 CEST 2009


Hi,

On Thu, Jun 04, 2009, git version control wrote:
> +    bool is_asynch_dispatch_thread = vlc_threadvar_get(queue(p_em)->is_asynch_dispatch_thread_var);
> +
> +    // Wait for the asynch_loop to have processed all events.
> +    if(!queue(p_em)->is_idle && !is_asynch_dispatch_thread)
> +    {
> +        vlc_cond_wait(&queue(p_em)->signal_idle, &queue(p_em)->lock);
> +        assert(queue(p_em)->is_idle);
> +    }
 vlc_cond_wait is probably mis-used here. A vlc_cond_wait/timedwait can and
will wakeup without having been signaled. So either you support supurious wake-up
(and the assert+comment seems wrong, or a while() has to be added.

>              mutex_cleanup_push(&queue(p_em)->lock);
> +            vlc_cond_broadcast(&queue(p_em)->signal_idle); // We'll be idle
>              vlc_cond_wait(&queue(p_em)->signal, &queue(p_em)->lock);
 Probably the same here.

-- 
fenrir



More information about the vlc-devel mailing list