Commit 21efe649 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

update: use vlc_atomic_* instead of vlc_object_(kill|alive)

parent 495130c5
......@@ -143,7 +143,7 @@ void update_Delete( update_t *p_update )
if( p_update->p_download )
{
vlc_object_kill( p_update->p_download );
vlc_atomic_set( &p_update->p_download->aborted, 1 );
vlc_join( p_update->p_download->thread, NULL );
vlc_object_release( p_update->p_download );
}
......@@ -494,7 +494,7 @@ void update_Download( update_t *p_update, const char *psz_destdir )
// If the object already exist, destroy it
if( p_update->p_download )
{
vlc_object_kill( p_update->p_download );
vlc_atomic_set( &p_udt->p_download->aborted, 1 );
vlc_join( p_update->p_download->thread, NULL );
vlc_object_release( p_update->p_download );
}
......@@ -509,6 +509,7 @@ void update_Download( update_t *p_update, const char *psz_destdir )
p_update->p_download = p_udt;
p_udt->psz_destdir = psz_destdir ? strdup( psz_destdir ) : NULL;
vlc_atomic_set(&p_udt->aborted, 0);
vlc_clone( &p_udt->thread, update_DownloadReal, p_udt, VLC_THREAD_PRIORITY_LOW );
}
......@@ -589,7 +590,7 @@ static void* update_DownloadReal( void *obj )
if( p_progress == NULL )
goto end;
while( vlc_object_alive( p_udt ) &&
while( !vlc_atomic_get( &p_udt->aborted ) &&
( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
!dialog_ProgressCancelled( p_progress ) )
{
......@@ -617,7 +618,7 @@ static void* update_DownloadReal( void *obj )
fclose( p_file );
p_file = NULL;
if( vlc_object_alive( p_udt ) &&
if( !vlc_atomic_get( &p_udt->aborted ) &&
!dialog_ProgressCancelled( p_progress ) )
{
dialog_ProgressDestroy( p_progress );
......
......@@ -38,6 +38,7 @@
*/
#include <vlc_update.h>
#include <vlc_atomic.h>
enum /* Public key algorithms */
{
......@@ -152,6 +153,7 @@ typedef struct
VLC_COMMON_MEMBERS
vlc_thread_t thread;
vlc_atomic_t aborted;
update_t *p_update;
char *psz_destdir;
} update_download_thread_t;
......
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