From 24b1008f2b0f85d005a887de2c045c07ad33779f Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 6 Oct 2010 16:30:54 +0000 Subject: [PATCH] Fixed a theoretically possible race condition of burn end and ISO generator end --- libisoburn/trunk/xorriso/write_run.c | 14 +++++++++++++- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libisoburn/trunk/xorriso/write_run.c b/libisoburn/trunk/xorriso/write_run.c index d9b28ebc..54cc888a 100644 --- a/libisoburn/trunk/xorriso/write_run.c +++ b/libisoburn/trunk/xorriso/write_run.c @@ -979,6 +979,9 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive, double first_base_count= 0.0, norm= 0.0, now_time, fract_offset= 0.0; double measured_speed, speed_factor= 1385000, quot; time_t time_prediction; + IsoImage *image= NULL; + + image= isoburn_get_attached_image(drive); start_time= Sfile_microtime(0); while(burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) @@ -1003,8 +1006,17 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive, last_time= current_time; last_sector= progress.sector; drive_status= burn_drive_get_status(drive, &progress); - if(drive_status == BURN_DRIVE_IDLE) + + if(drive_status == BURN_DRIVE_IDLE) { + + /* To avoid a race condition between burn_source and libisofs + writer thread: Wait for ISO generator thread to have finished. + */ + if(image == NULL) break; + if(!iso_image_generator_is_running(image)) + break; + } current_time= Sfile_microtime(0); if(drive_status == BURN_DRIVE_WRITING && progress.sectors > 0) { if(current_time-last_time>0.2) diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index bcee5911..a1e9c9c1 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.10.05.180016" +#define Xorriso_timestamP "2010.10.06.162230"