libvlc_event_async_fini(libvlc_event_manager_t * p_em)
{
if(!is_queue_initialized(p_em)) return;
+
+ if(current_thread_is_asynch_thread(p_em))
+ {
+ fprintf(stderr, "*** Error: releasing the last reference of the observed object from its callback thread is not (yet!) supported\n");
+ abort();
+ }
vlc_thread_t thread = queue(p_em)->thread;
if(thread)
{
p_em->async_event_queue = calloc(1, sizeof(struct libvlc_event_async_queue));
- int error = vlc_clone (&queue(p_em)->thread, event_async_loop, p_em, VLC_THREAD_PRIORITY_LOW);
+ int error = vlc_threadvar_create(&queue(p_em)->is_asynch_dispatch_thread_var, NULL);
+ assert(!error);
+
+ vlc_mutex_init(&queue(p_em)->lock);
+ vlc_cond_init(&queue(p_em)->signal);
+ vlc_cond_init(&queue(p_em)->signal_idle);
+
+ error = vlc_clone (&queue(p_em)->thread, event_async_loop, p_em, VLC_THREAD_PRIORITY_LOW);
if(error)
{
free(p_em->async_event_queue);
return;
}
- vlc_mutex_init(&queue(p_em)->lock);
- vlc_cond_init(&queue(p_em)->signal);
- vlc_cond_init(&queue(p_em)->signal_idle);
- error = vlc_threadvar_create(&queue(p_em)->is_asynch_dispatch_thread_var, NULL);
- assert(!error);
}
/**************************************************************************
{
if(!is_queue_initialized(p_em)) return;
- if(current_thread_is_asynch_thread(p_em))
- {
- fprintf(stderr, "*** Error: releasing the last reference of the observed object from its callback thread is not (yet!) supported\n");
- abort();
- }
-
queue_lock(p_em);
pop_listener(p_em, listener);
libvlc_event_listener_t listener;
libvlc_event_t event;
- vlc_threadvar_set(queue(p_em)->is_asynch_dispatch_thread_var, (void*)true);
+ vlc_threadvar_set(queue(p_em)->is_asynch_dispatch_thread_var, p_em);
queue_lock(p_em);
while (true) {