Commit be400691 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Plugins: push cancellation down

parent 974a5e40
......@@ -363,6 +363,7 @@ static void* Raw1394EventThread( vlc_object_t *p_this )
access_t *p_access = (access_t *) p_ev->p_access;
access_sys_t *p_sys = (access_sys_t *) p_access->p_sys;
int result = 0;
int canc = vlc_savecancel ();
AVCPlay( p_access, p_sys->i_node );
......@@ -386,6 +387,7 @@ static void* Raw1394EventThread( vlc_object_t *p_this )
}
AVCStop( p_access, p_sys->i_node );
vlc_restorecancel (canc);
return NULL;
}
......
......@@ -1263,6 +1263,8 @@ static void* EventThread( vlc_object_t *p_this )
p_ev->i_key_action = 0;
p_ev->b_still = false;
int canc = vlc_savecancel ();
/* catch all key event */
var_AddCallback( p_ev->p_libvlc, "key-action", EventKey, p_ev );
......@@ -1373,7 +1375,7 @@ static void* EventThread( vlc_object_t *p_this )
vlc_object_release( p_vout );
}
var_DelCallback( p_ev->p_libvlc, "key-action", EventKey, p_ev );
vlc_restorecancel (canc);
vlc_mutex_destroy( &p_ev->lock );
return NULL;
......
......@@ -1609,6 +1609,7 @@ static void* KeepAliveThread( vlc_object_t *p_this )
vlc_object_lock( p_thread );
while( vlc_object_alive( p_thread) )
{
int canc = vlc_savecancel ();
b_paused = p_thread->b_paused;
if( b_paused && b_was_paused )
......@@ -1616,6 +1617,7 @@ static void* KeepAliveThread( vlc_object_t *p_this )
b_was_paused = b_paused;
vlc_object_timedwait( p_thread, mdate() + 10000000 );
vlc_restorecancel (canc);
}
vlc_object_unlock( p_thread );
return NULL;
......
......@@ -507,6 +507,7 @@ static void* ThreadControl( vlc_object_t *p_this )
{
rtmp_control_thread_t *p_thread = (rtmp_control_thread_t *) p_this;
rtmp_packet_t *rtmp_packet;
int canc = vlc_savecancel ();
rtmp_init_handler( p_thread->rtmp_handler );
......@@ -543,5 +544,6 @@ static void* ThreadControl( vlc_object_t *p_this )
block_FifoWake( p_thread->p_fifo_input );
}
}
vlc_restorecancel (canc);
return NULL;
}
......@@ -279,6 +279,7 @@ static void* Thread( vlc_object_t* p_this )
access_t *p_src = p_access->p_source;
block_t *p_block;
int canc = vlc_savecancel ();
while( vlc_object_alive (p_access) )
{
/* Get a new block from the source */
......@@ -357,6 +358,7 @@ static void* Thread( vlc_object_t* p_this )
/* Send dummy packet to avoid deadlock in Block() */
block_FifoPut( p_sys->p_fifo, block_New( p_access, 0 ) );
vlc_restorecancel (canc);
return NULL;
}
......
......@@ -186,11 +186,13 @@ static void* poll_iterate_thread( vlc_object_t *p_this )
{
poll_thread_t *p_pt = (poll_thread_t*)p_this;
vlc_thread_ready( p_pt );
int canc = vlc_savecancel ();
while( vlc_object_alive (p_pt) )
if( avahi_simple_poll_iterate( p_pt->simple_poll, 100 ) != 0 )
break;
vlc_restorecancel (canc);
return NULL;
}
......
......@@ -383,6 +383,7 @@ static void* ThreadControl( vlc_object_t *p_this )
{
rtmp_control_thread_t *p_thread = (rtmp_control_thread_t *) p_this;
rtmp_packet_t *rtmp_packet;
int canc = vlc_savecancel ();
rtmp_init_handler( p_thread->rtmp_handler );
......@@ -416,5 +417,6 @@ static void* ThreadControl( vlc_object_t *p_this )
p_thread->b_die = 1;
}
}
vlc_restorecancel (canc);
return NULL;
}
......@@ -443,6 +443,7 @@ static void* ThreadWrite( vlc_object_t *p_this )
mtime_t i_date_last = -1;
mtime_t i_to_send = p_thread->i_group;
int i_dropped_packets = 0;
int canc = vlc_savecancel ();
while( vlc_object_alive (p_thread) )
{
......@@ -519,5 +520,6 @@ static void* ThreadWrite( vlc_object_t *p_this )
i_date_last = i_date;
}
vlc_restorecancel (canc);
return NULL;
}
......@@ -764,6 +764,7 @@ static void* ALSAThread( vlc_object_t* p_this )
{
aout_instance_t * p_aout = (aout_instance_t*)p_this;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
int canc = vlc_savecancel ();
p_sys->p_status = (snd_pcm_status_t *)malloc(snd_pcm_status_sizeof());
/* Wait for the exact time to start playing (avoids resampling) */
......@@ -785,6 +786,7 @@ static void* ALSAThread( vlc_object_t* p_this )
cleanup:
snd_pcm_drop( p_sys->p_snd_pcm );
free( p_aout->output.p_sys->p_status );
vlc_restorecancel (canc);
return NULL;
}
......
......@@ -1054,6 +1054,7 @@ static void* DirectSoundThread( vlc_object_t *p_this )
mtime_t last_time;
HRESULT dsresult;
long l_queued = 0;
int canc = vlc_savecancel ();
/* We don't want any resampling when using S/PDIF output */
b_sleek = p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i');
......@@ -1148,6 +1149,7 @@ static void* DirectSoundThread( vlc_object_t *p_this )
/* free the event */
CloseHandle( p_notif->event );
vlc_restorecancel (canc);
msg_Dbg( p_notif, "DirectSoundThread exiting" );
return NULL;
}
......@@ -222,6 +222,7 @@ static void* Thread( vlc_object_t *p_this )
aout_buffer_t * p_buffer;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
PCMAudioPlayer * pPlayer = p_sys->pPlayer;
int canc = vlc_savecancel ();
while( vlc_object_alive (p_aout) )
{
......@@ -254,6 +255,7 @@ static void* Thread( vlc_object_t *p_this )
#undef i
}
vlc_restorecancel (canc);
return NULL;
}
......
......@@ -590,6 +590,7 @@ static void* OSSThread( vlc_object_t *p_this )
aout_instance_t * p_aout = (aout_instance_t*)p_this;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
mtime_t next_date = 0;
int canc = vlc_savecancel ();
while ( vlc_object_alive (p_aout) )
{
......@@ -690,5 +691,6 @@ static void* OSSThread( vlc_object_t *p_this )
}
}
vlc_restorecancel (canc);
return NULL;
}
......@@ -573,6 +573,7 @@ static void* PORTAUDIOThread( vlc_object_t *p_this )
aout_instance_t *p_aout;
aout_sys_t *p_sys;
int i_err;
int canc = vlc_savecancel ();
while( vlc_object_alive (pa_thread) )
{
......@@ -645,6 +646,7 @@ static void* PORTAUDIOThread( vlc_object_t *p_this )
vlc_cond_signal( &pa_thread->wait );
vlc_mutex_unlock( &pa_thread->lock_wait );
}
vlc_restorecancel (canc);
return NULL;
}
#endif
......@@ -982,6 +982,7 @@ static void* WaveOutThread( vlc_object_t *p_this )
bool b_sleek;
mtime_t next_date;
uint32_t i_buffer_length = 64;
int canc = vlc_savecancel ();
/* We don't want any resampling when using S/PDIF */
b_sleek = p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i');
......@@ -1108,6 +1109,7 @@ static void* WaveOutThread( vlc_object_t *p_this )
}
#undef waveout_warn
vlc_restorecancel (canc);
return NULL;
}
......
......@@ -706,6 +706,7 @@ int OpenEncoder( vlc_object_t *p_this )
static void* FfmpegThread( vlc_object_t *p_this )
{
struct thread_context_t *p_context = (struct thread_context_t *)p_this;
int canc = vlc_savecancel ();
while ( vlc_object_alive (p_context) && !p_context->b_error )
{
vlc_mutex_lock( &p_context->lock );
......@@ -730,6 +731,7 @@ static void* FfmpegThread( vlc_object_t *p_this )
vlc_mutex_unlock( &p_context->lock );
}
vlc_restorecancel (canc);
return NULL;
}
......
......@@ -1737,6 +1737,7 @@ static void* TimeoutPrevention( vlc_object_t * p_this )
vlc_thread_ready( p_timeout );
int canc = vlc_savecancel ();
/* Avoid lock */
while( vlc_object_alive (p_timeout) )
{
......@@ -1759,6 +1760,7 @@ static void* TimeoutPrevention( vlc_object_t * p_this )
p_timeout->i_remain -= 200000;
msleep( 200000 ); /* 200 ms */
}
vlc_restorecancel (canc);
}
/*****************************************************************************
......
......@@ -2770,6 +2770,7 @@ void * demux_sys_t::EventThread( vlc_object_t *p_this )
event_thread_t *p_ev = (event_thread_t*)p_this;
demux_sys_t *p_sys = p_ev->p_demux->p_sys;
vlc_object_t *p_vout = NULL;
int canc = vlc_savecancel ();
p_ev->b_moved = false;
p_ev->b_clicked = false;
......@@ -3071,6 +3072,7 @@ void * demux_sys_t::EventThread( vlc_object_t *p_this )
vlc_mutex_destroy( &p_ev->lock );
vlc_restorecancel (canc);
return VLC_SUCCESS;
}
......
......@@ -265,6 +265,7 @@ static void* QNXaoutThread( vlc_object_t *p_this )
{
aout_instance_t * p_aout = (aout_instance_t*)p_this;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
int canc = vlc_savecancel ();
while ( vlc_object_alive (p_aout) )
{
......@@ -321,6 +322,7 @@ static void* QNXaoutThread( vlc_object_t *p_this )
}
}
vlc_restorecancel (canc);
return NULL;
}
......@@ -311,6 +311,7 @@ static void *Init( vlc_object_t *obj )
char dummy[] = "";
char *argv[] = { dummy };
int argc = 1;
int canc = vlc_savecancel ();
Q_INIT_RESOURCE( vlc );
......@@ -464,6 +465,8 @@ static void *Init( vlc_object_t *obj )
/* Save the path */
config_PutPsz( p_intf, "qt-filedialog-path", p_intf->p_sys->psz_filepath );
free( psz_path );
vlc_restorecancel (canc);
return NULL;
}
/*****************************************************************************
......
......@@ -213,6 +213,7 @@ static void* MainLoop( vlc_object_t * p_this )
intf_thread_t *p_intf = (intf_thread_t*)p_this;
MSG msg;
Interface *intf = 0;
int canc = vlc_savecancel ();
if( !hInstance ) hInstance = GetModuleHandle(NULL);
......@@ -268,6 +269,7 @@ static void* MainLoop( vlc_object_t * p_this )
/* Uninitialize OLE/COM */
CoUninitialize();
#endif
vlc_restorecancel (canc);
return NULL;
}
......
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