mirror of
https://github.com/ipxe/ipxe
synced 2025-12-26 01:22:37 +03:00
Added basic code for implementing co-operative multitasking.
Yes, you really can do it in 65 bytes.
This commit is contained in:
32
src/include/gpxe/process.h
Normal file
32
src/include/gpxe/process.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef _GPXE_PROCESS_H
|
||||
#define _GPXE_PROCESS_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Processes
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gpxe/list.h>
|
||||
|
||||
/** 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 */
|
||||
Reference in New Issue
Block a user