mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 20:40:25 +03:00
[cmdline] Rewrite "sync" command to use monojob_wait()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user