diff options
author | Michael Brown <mcb30@ipxe.org> | 2011-06-24 14:18:48 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2011-06-28 14:45:09 +0100 |
commit | ccc2655540f01cc4da018fc31fa16ce8cdb1f4b5 (patch) | |
tree | d1ba1902a58b9257ab30ec1ac643a707336dbfbb /src/include/ipxe/process.h | |
parent | e01ec74601b58f54a5e2ae7b9fd1196972034114 (diff) | |
download | ipxe-ccc2655540f01cc4da018fc31fa16ce8cdb1f4b5.tar.gz |
[process] Add support for one-shot processes
Some processes execute only once, and exist solely in order to defer
execution until after the relevant instantiator method has returned.
Such processes do not need to be automatically rescheduled when
executing.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/process.h')
-rw-r--r-- | src/include/ipxe/process.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/ipxe/process.h b/src/include/ipxe/process.h index f8b10a8ae..9b7579817 100644 --- a/src/include/ipxe/process.h +++ b/src/include/ipxe/process.h @@ -39,6 +39,8 @@ struct process_descriptor { * CPU to another process. */ void ( * step ) ( void *object ); + /** Automatically reschedule the process */ + int reschedule; }; /** @@ -78,6 +80,21 @@ struct process_descriptor { #define PROC_DESC( object_type, process, _step ) { \ .offset = process_offset ( object_type, process ), \ .step = PROC_STEP ( object_type, _step ), \ + .reschedule = 1, \ + } + +/** + * Define a process descriptor for a process that runs only once + * + * @v object_type Containing object data type + * @v process Process name (i.e. field within object data type) + * @v step Process' step() method + * @ret desc Object interface descriptor + */ +#define PROC_DESC_ONCE( object_type, process, _step ) { \ + .offset = process_offset ( object_type, process ), \ + .step = PROC_STEP ( object_type, _step ), \ + .reschedule = 0, \ } /** @@ -91,6 +108,7 @@ struct process_descriptor { #define PROC_DESC_PURE( _step ) { \ .offset = 0, \ .step = PROC_STEP ( struct process, _step ), \ + .reschedule = 1, \ } extern void * __attribute__ (( pure )) |