Slowed down highspeed loops waiting for drive status changes

trunk@386
Thomas Schmitt 16 years ago
parent 244724d205
commit 59f0c4caa3
  1. 18
      cdrskin/cdrskin.c
  2. 3
      libburn/drive.c
  3. 6
      test/libburner.c
  4. 6
      test/testburner.c

@ -2297,6 +2297,9 @@ int Cdrskin_grab_drive(struct CdrskiN *skin, int flag)
ClN(fprintf(stderr,
"cdrskin_debug: Cdrskin_grab_drive() on active libburn\n"));
if(strlen(skin->preskin->device_adr)<=0) {
/* >>> forget unwanted drives here ! */;
ret= Cdrskin_reinit_lib_with_adr(skin,1|(flag&2));
goto ex; /* this calls Cdrskin_grab() with persistent address or fails */
}
@ -2810,9 +2813,9 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag)
return(ret);
drive= skin->drives[skin->driveno].drive;
while(burn_drive_get_status(drive,NULL))
sleep(2);
usleep(100002);
while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
sleep(2);
usleep(100002);
Cdrskin_report_disc_status(skin,s,0);
if(s==BURN_DISC_APPENDABLE && skin->no_blank_appendable) {
is_not_really_erasable= 1;
@ -2864,7 +2867,8 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag)
}
if(strlen(skin->preskin->device_adr)>0)
burn_drive_add_whitelist(skin->preskin->device_adr);
while (!burn_drive_scan(&(skin->drives), &(skin->n_drives))) ;
while(!burn_drive_scan(&(skin->drives),&(skin->n_drives)))
usleep(1002);
ret= Cdrskin_grab_drive(skin,0);
if(ret<=0)
return(ret);
@ -2960,9 +2964,9 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
drive= skin->drives[skin->driveno].drive;
while(burn_drive_get_status(drive,NULL))
sleep(2);
usleep(100002);
while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
sleep(2);
usleep(100002);
if(skin->verbosity>=Cdrskin_verbose_progresS)
Cdrskin_report_disc_status(skin,s,0);
if(s!=BURN_DISC_FULL &&
@ -3341,10 +3345,10 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
drive= skin->drives[skin->driveno].drive;
while (burn_drive_get_status(drive, NULL))
sleep(2); /* >>> ??? add a timeout ? */
usleep(100002); /* >>> ??? add a timeout ? */
while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
sleep(2); /* >>> ??? add a timeout ? */
usleep(100002); /* >>> ??? add a timeout ? */
if(skin->verbosity>=Cdrskin_verbose_progresS)
Cdrskin_report_disc_status(skin,s,0);

@ -626,7 +626,8 @@ int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], char* adr,
fprintf(stderr,"libburn: experimental: burn_drive_scan_and_grab(%s)\n",
adr);
*/
while (!burn_drive_scan(drive_infos, &n_drives));
while (!burn_drive_scan(drive_infos, &n_drives))
usleep(1002);
if (n_drives <= 0)
return 0;
/*

@ -162,7 +162,8 @@ int libburner_aquire_by_driveno(int *driveno)
int ret, i;
printf("Beginning to scan for devices ...\n");
while (!burn_drive_scan(&drive_list, &drive_count)) ;
while (!burn_drive_scan(&drive_list, &drive_count))
usleep(1002);
if (drive_count <= 0 && *driveno >= 0) {
printf("FAILED (no drives found)\n");
return 0;
@ -433,7 +434,8 @@ int libburner_payload(struct burn_drive *drive, const char *source_adr,
burn_disc_write(burn_options, target_disc);
burn_write_opts_free(burn_options);
while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) ;
while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING)
usleep(1002);
while (burn_drive_get_status(drive, &progress)) {
if( progress.sectors <= 0 || progress.sector == last_sector)
printf(

@ -260,7 +260,8 @@ int libburner_aquire_by_driveno(int *driveno)
int ret= 0, i;
printf("Beginning to scan for devices ...\n");
while (!burn_drive_scan(&drive_list, &drive_count)) ;
while (!burn_drive_scan(&drive_list, &drive_count))
usleep(1002);
if (drive_count <= 0 && *driveno >= 0) {
printf("FAILED (no drives found)\n");
return 0;
@ -537,7 +538,8 @@ int libburner_payload(struct burn_drive *drive, const char *source_adr,
burn_disc_write(burn_options, target_disc);
burn_write_opts_free(burn_options);
while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) ;
while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING)
usleep(1002);
while (burn_drive_get_status(drive, &progress)) {
if( progress.sectors <= 0 || progress.sector == last_sector)
printf(

Loading…
Cancel
Save