mirror of
https://github.com/ipxe/ipxe
synced 2025-12-30 04:28:12 +03:00
[cmdline] Rewrite "sync" command to use monojob_wait()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -9,8 +9,6 @@
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
#include <ipxe/list.h>
|
||||
|
||||
/** A pending operation */
|
||||
struct pending_operation {
|
||||
/** Pending count */
|
||||
@@ -21,14 +19,24 @@ struct pending_operation {
|
||||
* Check if an operation is pending
|
||||
*
|
||||
* @v pending Pending operation
|
||||
* @v is_pending Operation is pending
|
||||
* @ret is_pending Operation is pending
|
||||
*/
|
||||
static inline int is_pending ( struct pending_operation *pending ) {
|
||||
return ( pending->count != 0 );
|
||||
}
|
||||
|
||||
extern int pending_total;
|
||||
|
||||
/**
|
||||
* Check if any operations are pending
|
||||
*
|
||||
* @ret have_pending Some operations are pending
|
||||
*/
|
||||
static inline int have_pending ( void ) {
|
||||
return ( pending_total != 0 );
|
||||
}
|
||||
|
||||
extern void pending_get ( struct pending_operation *pending );
|
||||
extern void pending_put ( struct pending_operation *pending );
|
||||
extern int pending_wait ( unsigned long timeout );
|
||||
|
||||
#endif /* _IPXE_PENDING_H */
|
||||
|
||||
14
src/include/usr/sync.h
Normal file
14
src/include/usr/sync.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _USR_SYNC_H
|
||||
#define _USR_SYNC_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Wait for pending operations to complete
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
extern int sync ( unsigned long timeout );
|
||||
|
||||
#endif /* _USR_SYNC_H */
|
||||
Reference in New Issue
Block a user