Cancelling libisofs write thread in case of early libburn end

This commit is contained in:
Thomas Schmitt 2010-10-20 07:52:47 +00:00
parent 47d6c59b26
commit 61e803a3a7
2 changed files with 12 additions and 9 deletions

View File

@ -987,7 +987,7 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
int flag) int flag)
{ {
int ret, size, free_bytes, i, aborting= 0, emul, buffer_fill= 50, last_sector; int ret, size, free_bytes, i, aborting= 0, emul, buffer_fill= 50, last_sector;
int iso_wait_counter= 0, iso_cancel_limit= 5, iso_break_limit= 10; int iso_wait_counter= 0, iso_cancel_limit= 5, iso_break_limit= 20;
int iso_cancelled= 0; int iso_cancelled= 0;
struct burn_progress progress; struct burn_progress progress;
char *status_text, date_text[80], *speed_unit, mem_text[8]; char *status_text, date_text[80], *speed_unit, mem_text[8];
@ -1032,17 +1032,20 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
*/ */
if(image == NULL) if(image == NULL)
break; break;
if(!iso_image_generator_is_running(image)) { if(!iso_image_generator_is_running(image))
break; break;
} else if(iso_wait_counter > iso_cancel_limit && !iso_cancelled) { iso_wait_counter++;
if(iso_wait_counter > iso_cancel_limit && !iso_cancelled) {
/* >>> cancel image burn source */; isoburn_cancel_prepared_write(drive, NULL, 0);
iso_cancelled= 1; iso_cancelled= 1;
} else if(iso_wait_counter > iso_break_limit) { } else if(iso_wait_counter > iso_break_limit) {
/* >>> This is dangerous. xorriso will free memory objects which might /* >>> This can be dangerous. xorriso will free memory objects which
be in use in the unstoppable libisofs thread. might be in use in the unstoppable libisofs thread.
The current implementation of ecma119.c:bs_cancel() seems to
wait for the writer thread to end. Probably one should make
this a part of the libisofs API specs and break the loop
directly after isoburn_cancel_prepared_write().
*/ */
break; break;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.10.19.170704" #define Xorriso_timestamP "2010.10.20.075221"