From 23c494d14efafdd1dd06cec53665ddfd1c20fa34 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 29 Apr 2006 16:42:09 +0000 Subject: Added basic code for implementing co-operative multitasking. Yes, you really can do it in 65 bytes. --- src/include/gpxe/process.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/include/gpxe/process.h (limited to 'src/include') diff --git a/src/include/gpxe/process.h b/src/include/gpxe/process.h new file mode 100644 index 000000000..83ff83934 --- /dev/null +++ b/src/include/gpxe/process.h @@ -0,0 +1,32 @@ +#ifndef _GPXE_PROCESS_H +#define _GPXE_PROCESS_H + +/** @file + * + * Processes + * + */ + +#include + +/** A process */ +struct process { + /** List of processes */ + struct list_head list; + /** + * Single-step the process + * + * This method should execute a single step of the process. + * Returning from this method is isomorphic to yielding the + * CPU to another process. + * + * If the process wishes to be executed again, it must re-add + * itself to the run queue using schedule(). + */ + void ( * step ) ( struct process *process ); +}; + +extern void schedule ( struct process *process ); +extern void step ( void ); + +#endif /* _GPXE_PROCESS_H */ -- cgit v1.2.3-55-g7522