|  | @@ -64,7 +64,7 @@ struct interface monojob = INTF_INIT ( monojob_intf_desc );
 | 
		
	
		
			
			| 64 | 64 |   */
 | 
		
	
		
			
			| 65 | 65 |  int monojob_wait ( const char *string, unsigned long timeout ) {
 | 
		
	
		
			
			| 66 | 66 |  	struct job_progress progress;
 | 
		
	
		
			
			| 67 |  | -	unsigned long last_keycheck;
 | 
		
	
		
			
			|  | 67 | +	unsigned long last_check;
 | 
		
	
		
			
			| 68 | 68 |  	unsigned long last_progress;
 | 
		
	
		
			
			| 69 | 69 |  	unsigned long last_display;
 | 
		
	
		
			
			| 70 | 70 |  	unsigned long now;
 | 
		
	
	
		
			
			|  | @@ -81,26 +81,28 @@ int monojob_wait ( const char *string, unsigned long timeout ) {
 | 
		
	
		
			
			| 81 | 81 |  	if ( string )
 | 
		
	
		
			
			| 82 | 82 |  		printf ( "%s...", string );
 | 
		
	
		
			
			| 83 | 83 |  	monojob_rc = -EINPROGRESS;
 | 
		
	
		
			
			| 84 |  | -	last_keycheck = last_progress = last_display = currticks();
 | 
		
	
		
			
			|  | 84 | +	last_check = last_progress = last_display = currticks();
 | 
		
	
		
			
			| 85 | 85 |  	while ( monojob_rc == -EINPROGRESS ) {
 | 
		
	
		
			
			| 86 | 86 |  
 | 
		
	
		
			
			| 87 | 87 |  		/* Allow job to progress */
 | 
		
	
		
			
			| 88 | 88 |  		step();
 | 
		
	
		
			
			| 89 | 89 |  		now = currticks();
 | 
		
	
		
			
			| 90 | 90 |  
 | 
		
	
		
			
			| 91 |  | -		/* Check for keypresses.  This can be time-consuming,
 | 
		
	
		
			
			| 92 |  | -		 * so check only once per clock tick.
 | 
		
	
		
			
			|  | 91 | +		/* Continue until a timer tick occurs (to minimise
 | 
		
	
		
			
			|  | 92 | +		 * time wasted checking for progress and keypresses).
 | 
		
	
		
			
			| 93 | 93 |  		 */
 | 
		
	
		
			
			| 94 |  | -		elapsed = ( now - last_keycheck );
 | 
		
	
		
			
			| 95 |  | -		if ( elapsed ) {
 | 
		
	
		
			
			| 96 |  | -			if ( iskey() ) {
 | 
		
	
		
			
			| 97 |  | -				key = getchar();
 | 
		
	
		
			
			| 98 |  | -				if ( key == CTRL_C ) {
 | 
		
	
		
			
			| 99 |  | -					monojob_rc = -ECANCELED;
 | 
		
	
		
			
			| 100 |  | -					break;
 | 
		
	
		
			
			| 101 |  | -				}
 | 
		
	
		
			
			|  | 94 | +		elapsed = ( now - last_check );
 | 
		
	
		
			
			|  | 95 | +		if ( ! elapsed )
 | 
		
	
		
			
			|  | 96 | +			continue;
 | 
		
	
		
			
			|  | 97 | +		last_check = now;
 | 
		
	
		
			
			|  | 98 | +
 | 
		
	
		
			
			|  | 99 | +		/* Check for keypresses */
 | 
		
	
		
			
			|  | 100 | +		if ( iskey() ) {
 | 
		
	
		
			
			|  | 101 | +			key = getchar();
 | 
		
	
		
			
			|  | 102 | +			if ( key == CTRL_C ) {
 | 
		
	
		
			
			|  | 103 | +				monojob_rc = -ECANCELED;
 | 
		
	
		
			
			|  | 104 | +				break;
 | 
		
	
		
			
			| 102 | 105 |  			}
 | 
		
	
		
			
			| 103 |  | -			last_keycheck = now;
 | 
		
	
		
			
			| 104 | 106 |  		}
 | 
		
	
		
			
			| 105 | 107 |  
 | 
		
	
		
			
			| 106 | 108 |  		/* Monitor progress */
 |