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

SD: pull down cancellation safety on those SD with lame threads

parent 76f2181d
......@@ -300,6 +300,7 @@ static void Run( services_discovery_t *p_sd )
int i, i_devices;
char **devices;
services_discovery_sys_t *p_sys = p_sd->p_sys;
int canc = vlc_savecancel();
/* parse existing devices first */
if( ( devices = libhal_get_all_devices( p_sys->p_ctx, &i_devices, NULL ) ) )
......@@ -310,12 +311,16 @@ static void Run( services_discovery_t *p_sd )
libhal_free_string( devices[ i ] );
}
}
/* FIXME: Totally lame. There are DBus watch functions to do this properly.
* -- Courmisch, 28/08/2008 */
while( vlc_object_alive (p_sd) )
{
/* look for events on the bus, blocking 1 second */
dbus_connection_read_write_dispatch( p_sys->p_connection, 1000 );
/* HAL 0.5.8.1 can use libhal_ctx_get_dbus_connection(p_sys->p_ctx) */
}
vlc_restorecancel (canc);
}
void DeviceAdded( LibHalContext *p_ctx, const char *psz_udi )
......
......@@ -159,9 +159,12 @@ static void Run( services_discovery_t *p_sd )
var_Create( p_sd, "podcast-urls", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_AddCallback( p_sd, "podcast-urls", UrlsChange, p_sys );
while( vlc_object_alive (p_sd) )
for( ;; )
{
int i;
/* FIXME: That's 2000 wake up per seconds too many. */
msleep( 500 );
int canc = vlc_savecancel (); /* <- FIXME: should not be needed */
if( p_sys->b_update == true )
{
msg_Dbg( p_sd, "Update required" );
......@@ -172,7 +175,7 @@ static void Run( services_discovery_t *p_sd )
p_sys->b_update = false;
}
for( i = 0; i < p_sd->p_sys->i_input; i++ )
for( int i = 0; i < p_sd->p_sys->i_input; i++ )
{
if( p_sd->p_sys->pp_input[i]->b_eof
|| p_sd->p_sys->pp_input[i]->b_error )
......@@ -184,7 +187,7 @@ static void Run( services_discovery_t *p_sd )
i--;
}
}
msleep( 500 );
vlc_restorecancel (canc);
}
}
......
......@@ -215,6 +215,7 @@ static void Run( services_discovery_t *p_sd )
{
enum type_e i_type = (enum type_e)p_sd->p_sys;
int i, j;
int canc = vlc_savecancel();
if( !p_items[i_type].p_children )
{
......@@ -238,6 +239,7 @@ static void Run( services_discovery_t *p_sd )
vlc_gc_decref( p_input );
}
}
vlc_restorecancel(canc);
}
/*****************************************************************************
......
Supports Markdown
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