[cmdline] Rewrite "sync" command to use monojob_wait()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-11-01 01:56:33 +00:00
parent dc7a023715
commit 92c56e129b
5 changed files with 103 additions and 25 deletions

View File

@@ -31,7 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
*/
/** Total count of pending operations */
static int pending_total;
int pending_total;
/**
* Mark an operation as pending
@@ -60,21 +60,3 @@ void pending_put ( struct pending_operation *pending ) {
pending, pending->count, pending_total );
}
}
/**
* Wait for pending operations to complete
*
* @v timeout Timeout period, in ticks (0=indefinite)
* @ret rc Return status code
*/
int pending_wait ( unsigned long timeout ) {
unsigned long start = currticks();
do {
if ( pending_total == 0 )
return 0;
step();
} while ( ( timeout == 0 ) || ( ( currticks() - start ) < timeout ) );
return -ETIMEDOUT;
}