aboutsummaryrefslogtreecommitdiff
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-06-09 18:48:09 +0100
committerMichael Brown <mcb30@ipxe.org>2012-06-09 18:48:28 +0100
commit021d7b21b7f30a8de9ff56ae3a70026bafcdc542 (patch)
tree152dfd6bf7f7a8622014bd938e7b12a48ac47c2a /src/include/ipxe
parent591541af667dbf3617b81d89f92abf01e9e1a16d (diff)
downloadipxe-021d7b21b7f30a8de9ff56ae3a70026bafcdc542.zip
ipxe-021d7b21b7f30a8de9ff56ae3a70026bafcdc542.tar.gz
ipxe-021d7b21b7f30a8de9ff56ae3a70026bafcdc542.tar.bz2
[pending] Add concept of "pending operations"
iPXE is fundamentally asynchronous in operation: some operations continue in the background even after the foreground has continued to a new task. For example, the closing FIN/ACK exchanges of a TCP connection will take place in the background after an HTTP download has completed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/errfile.h1
-rw-r--r--src/include/ipxe/pending.h34
2 files changed, 35 insertions, 0 deletions
diff --git a/src/include/ipxe/errfile.h b/src/include/ipxe/errfile.h
index 108efc7..5fc0e08 100644
--- a/src/include/ipxe/errfile.h
+++ b/src/include/ipxe/errfile.h
@@ -62,6 +62,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define ERRFILE_parseopt ( ERRFILE_CORE | 0x00160000 )
#define ERRFILE_test ( ERRFILE_CORE | 0x00170000 )
#define ERRFILE_xferbuf ( ERRFILE_CORE | 0x00180000 )
+#define ERRFILE_pending ( ERRFILE_CORE | 0x00190000 )
#define ERRFILE_eisa ( ERRFILE_DRIVER | 0x00000000 )
#define ERRFILE_isa ( ERRFILE_DRIVER | 0x00010000 )
diff --git a/src/include/ipxe/pending.h b/src/include/ipxe/pending.h
new file mode 100644
index 0000000..51afb43
--- /dev/null
+++ b/src/include/ipxe/pending.h
@@ -0,0 +1,34 @@
+#ifndef _IPXE_PENDING_H
+#define _IPXE_PENDING_H
+
+/** @file
+ *
+ * Pending operations
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+#include <ipxe/list.h>
+
+/** A pending operation */
+struct pending_operation {
+ /** Pending count */
+ unsigned int count;
+};
+
+/**
+ * Check if an operation is pending
+ *
+ * @v pending Pending operation
+ * @v is_pending Operation is pending
+ */
+static inline int is_pending ( struct pending_operation *pending ) {
+ return ( pending->count != 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 */