1
#ifndef _GPXE_PROCESS_H
2
#define _GPXE_PROCESS_H
10
FILE_LICENCE ( GPL2_OR_LATER );
12
#include <gpxe/list.h>
13
#include <gpxe/refcnt.h>
14
#include <gpxe/tables.h>
18
/** List of processes */
19
struct list_head list;
21
* Single-step the process
23
* This method should execute a single step of the process.
24
* Returning from this method is isomorphic to yielding the
25
* CPU to another process.
27
void ( * step ) ( struct process *process );
30
* If this interface is not part of a reference-counted
31
* object, this field may be NULL.
33
struct refcnt *refcnt;
36
extern void process_add ( struct process *process );
37
extern void process_del ( struct process *process );
38
extern void step ( void );
41
* Initialise process without adding to process list
44
* @v step Process' step() method
46
static inline __attribute__ (( always_inline )) void
47
process_init_stopped ( struct process *process,
48
void ( * step ) ( struct process *process ),
49
struct refcnt *refcnt ) {
50
INIT_LIST_HEAD ( &process->list );
52
process->refcnt = refcnt;
56
* Initialise process and add to process list
59
* @v step Process' step() method
61
static inline __attribute__ (( always_inline )) void
62
process_init ( struct process *process,
63
void ( * step ) ( struct process *process ),
64
struct refcnt *refcnt ) {
65
process_init_stopped ( process, step, refcnt );
66
process_add ( process );
69
/** Permanent process table */
70
#define PERMANENT_PROCESSES __table ( struct process, "processes" )
73
* Declare a permanent process
75
* Permanent processes will be automatically added to the process list
76
* at initialisation time.
78
#define __permanent_process __table_entry ( PERMANENT_PROCESSES, 01 )
80
#endif /* _GPXE_PROCESS_H */