* The decoding main loop
*
* \param p_dec the decoder
- * \return 0
*/
static void* DecoderThread( vlc_object_t *p_this )
{
decoder_t * p_dec = (decoder_t *)p_this;
block_t *p_block;
+ int canc = vlc_savecancel ();
/* The decoder's main loop */
while( !p_dec->b_die && !p_dec->b_error )
/* We do it here because of the dll loader that wants close() in the
* same thread than open()/decode() */
module_Unneed( p_dec, p_dec->p_module );
-
+ vlc_restorecancel (canc);
return NULL;
}
stream_t *s = (stream_t *)p_this;
d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys;
demux_t *p_demux;
+ int canc = vlc_savecancel ();
/* Create the demuxer */
if( !(p_demux = demux_New( s, "", p_sys->psz_name, "", s, p_sys->out,
if( p_demux->pf_demux( p_demux ) <= 0 ) break;
}
+ vlc_restorecancel (canc);
vlc_object_kill( p_demux );
return NULL;
}
static void* Run( vlc_object_t *p_this )
{
input_thread_t *p_input = (input_thread_t *)p_this;
+ int canc = vlc_savecancel ();
+
/* Signal that the thread is launched */
vlc_thread_ready( p_input );
/* Clean up */
End( p_input );
-
+ vlc_restorecancel (canc);
return NULL;
}
static void* RunAndDestroy( vlc_object_t *p_this )
{
input_thread_t *p_input = (input_thread_t *)p_this;
+ int canc;
+
/* Signal that the thread is launched */
vlc_thread_ready( p_input );
+ canc = vlc_savecancel ();
if( Init( p_input ) )
goto exit;
exit:
/* Release memory */
vlc_object_release( p_input );
+ vlc_restorecancel (canc);
return 0;
}
mtime_t i_lastcheck;
mtime_t i_time;
+ int canc = vlc_savecancel ();
i_lastcheck = vlm_Date();
while( !vlm->b_die )
msleep( 100000 );
}
+ vlc_restorecancel (canc);
return NULL;
}
static void* InteractionLoop( vlc_object_t *p_this )
{
- int i;
interaction_t *p_interaction = (interaction_t*) p_this;
+ int canc = vlc_savecancel ();
vlc_object_lock( p_this );
while( vlc_object_alive( p_this ) )
vlc_object_unlock( p_this );
/* Remove all dialogs - Interfaces must be able to clean up their data */
- for( i = p_interaction->i_dialogs -1 ; i >= 0; i-- )
+ for( int i = p_interaction->i_dialogs -1 ; i >= 0; i-- )
{
interaction_dialog_t * p_dialog = p_interaction->pp_dialogs[i];
DialogDestroy( p_dialog );
REMOVE_ELEM( p_interaction->pp_dialogs, p_interaction->i_dialogs, i );
}
+ vlc_restorecancel (canc);
return NULL;
}
intf_thread_t *p_intf = (intf_thread_t *)p_this;
vlc_value_t val, text;
char *psz_intf;
+ int canc = vlc_savecancel ();
/* Variable used for interface spawning */
var_Create( p_intf, "intf-add", VLC_VAR_STRING |
p_intf->p_module = module_Need( p_intf, "interface", psz_intf, 0 );
}
while( p_intf->p_module );
+
+ vlc_restorecancel (canc);
return NULL;
}
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
libvlc_int_t * p_libvlc = p_intf->p_libvlc;
+ int canc = vlc_savecancel ();
+
vlc_object_lock( p_libvlc );
while(vlc_object_alive( p_libvlc ) )
{
vlc_object_kill( p_intf );
}
vlc_list_release( p_list );
+ vlc_restorecancel (canc);
return NULL;
}
#endif
*****************************************************************************/
static void* AppThread( vlc_object_t * p_this )
{
+ int canc = vlc_savecancel ();
VlcApplication * BeApp =
new VlcApplication("application/x-vnd.videolan-vlc");
vlc_object_attach( p_this, p_this->p_libvlc );
BeApp->Run();
vlc_object_detach( p_this );
delete BeApp;
+ vlc_restorecancel (canc);
return NULL;
}
{
update_check_thread_t *p_uct = (update_check_thread_t *)p_this;
bool b_ret;
+ int canc;
+
+ vlc_savecancel (&canc);
vlc_mutex_lock( &p_uct->p_update->lock );
EmptyRelease( p_uct->p_update );
if( p_uct->pf_callback )
(p_uct->pf_callback)( p_uct->p_data, b_ret );
+
+ vlc_restorecancel (canc);
return NULL;
}
stream_t *p_stream = NULL;
void* p_buffer = NULL;
int i_read;
+ int canc;
update_t *p_update = p_udt->p_update;
char *psz_destdir = p_udt->psz_destdir;
msg_Dbg( p_udt, "Opening Stream '%s'", p_update->release.psz_url );
+ canc = vlc_savecancel ();
/* Open the stream */
p_stream = stream_UrlNew( p_udt, p_update->release.psz_url );
free( p_buffer );
free( psz_size );
+ p_udt->p_update->p_download = NULL;
+
+ vlc_object_release( p_udt );
+ vlc_restorecancel (canc);
return NULL;
}
counter_t *p_active_counter = stats_CounterCreate( host, VLC_VAR_INTEGER, STATS_COUNTER );
int evfd;
bool b_die;
+ int canc = vlc_savecancel ();
retry:
vlc_object_lock( host );
stats_CounterClean( p_total_counter );
if( p_active_counter )
stats_CounterClean( p_active_counter );
+ vlc_restorecancel (canc);
return NULL;
}
static void* RunSD( vlc_object_t *p_this )
{
services_discovery_t *p_sd = (services_discovery_t *)p_this;
- vlc_event_t event;
+ vlc_event_t event = {
+ .type = vlc_ServicesDiscoveryStarted
+ };
+ int canc = vlc_savecancel ();
- event.type = vlc_ServicesDiscoveryStarted;
vlc_event_send( &p_sd->event_manager, &event );
p_sd->pf_run( p_sd );
event.type = vlc_ServicesDiscoveryEnded;
vlc_event_send( &p_sd->event_manager, &event );
+ vlc_restorecancel (canc);
return NULL;
}
/* Tell above that we're ready */
vlc_thread_ready( p_playlist );
+ int canc = vlc_savecancel ();
vlc_object_lock( p_playlist );
while( vlc_object_alive( p_playlist ) )
{
vlc_object_unlock( p_playlist );
playlist_LastLoop( p_playlist );
+ vlc_restorecancel (canc);
return NULL;
}
static void* RunPreparse ( vlc_object_t *p_this )
{
playlist_preparse_t *p_obj = (playlist_preparse_t*)p_this;
+ int canc;
+
/* Tell above that we're ready */
vlc_thread_ready( p_obj );
+ canc = vlc_savecancel ();
playlist_PreparseLoop( p_obj );
+ vlc_restorecancel (canc);
return NULL;
}
playlist_fetcher_t *p_obj = (playlist_fetcher_t *)p_this;
/* Tell above that we're ready */
vlc_thread_ready( p_obj );
+ int canc = vlc_savecancel ();
playlist_FetcherLoop( p_obj );
+ vlc_restorecancel (canc);
return NULL;
}
{
sap_handler_t *p_sap = (sap_handler_t*)p_this;
sap_session_t *p_session;
+ int canc = vlc_savecancel ();
+ /* TODO: Once net_Write() is cancel-safe, so will this whole thread.
+ * However, there is a more serious issues here: msleep(SAP_IDLE).
+ * This thread should really use poll().
+ */
while( !p_sap->b_die )
{
}
vlc_object_unlock( p_sap );
}
+ vlc_restorecancel (canc);
return NULL;
}
bool b_drop_late;
int i_displayed = 0, i_lost = 0, i_loops = 0;
+ int canc = vlc_savecancel ();
/*
* Initialize thread
{
EndThread( p_vout );
vlc_mutex_unlock( &p_vout->change_lock );
+ vlc_restorecancel (canc);
return NULL;
}
vlc_mutex_unlock( &p_vout->change_lock );
vlc_object_unlock( p_vout );
+ vlc_restorecancel (canc);
return NULL;
}
static void* SuxorRestartVideoES( vlc_object_t * p_vlc_t )
{
suxor_thread_t *p_this = (suxor_thread_t *) p_vlc_t;
+ int canc = vlc_savecancel ();
/* Now restart current video stream */
int val = var_GetInteger( p_this->p_input, "video-es" );
if( val >= 0 )
}
vlc_object_release( p_this->p_input );
-
vlc_object_release( p_this );
+ vlc_restorecancel (canc);
return NULL;
}