mirror of
https://github.com/xcat2/xNBA.git
synced 2026-03-26 16:23:30 +00:00
Access to the gpxe.org and etherboot.org domains and associated resources has been revoked by the registrant of the domain. Work around this problem by renaming project from gPXE to iPXE, and updating URLs to match. Also update README, LOG and COPYRIGHTS to remove obsolete information. Signed-off-by: Michael Brown <mcb30@ipxe.org>
81 lines
1.9 KiB
C
81 lines
1.9 KiB
C
#ifndef _IPXE_PROCESS_H
|
|
#define _IPXE_PROCESS_H
|
|
|
|
/** @file
|
|
*
|
|
* Processes
|
|
*
|
|
*/
|
|
|
|
FILE_LICENCE ( GPL2_OR_LATER );
|
|
|
|
#include <ipxe/list.h>
|
|
#include <ipxe/refcnt.h>
|
|
#include <ipxe/tables.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.
|
|
*/
|
|
void ( * step ) ( struct process *process );
|
|
/** Reference counter
|
|
*
|
|
* If this interface is not part of a reference-counted
|
|
* object, this field may be NULL.
|
|
*/
|
|
struct refcnt *refcnt;
|
|
};
|
|
|
|
extern void process_add ( struct process *process );
|
|
extern void process_del ( struct process *process );
|
|
extern void step ( void );
|
|
|
|
/**
|
|
* Initialise process without adding to process list
|
|
*
|
|
* @v process Process
|
|
* @v step Process' step() method
|
|
*/
|
|
static inline __attribute__ (( always_inline )) void
|
|
process_init_stopped ( struct process *process,
|
|
void ( * step ) ( struct process *process ),
|
|
struct refcnt *refcnt ) {
|
|
INIT_LIST_HEAD ( &process->list );
|
|
process->step = step;
|
|
process->refcnt = refcnt;
|
|
}
|
|
|
|
/**
|
|
* Initialise process and add to process list
|
|
*
|
|
* @v process Process
|
|
* @v step Process' step() method
|
|
*/
|
|
static inline __attribute__ (( always_inline )) void
|
|
process_init ( struct process *process,
|
|
void ( * step ) ( struct process *process ),
|
|
struct refcnt *refcnt ) {
|
|
process_init_stopped ( process, step, refcnt );
|
|
process_add ( process );
|
|
}
|
|
|
|
/** Permanent process table */
|
|
#define PERMANENT_PROCESSES __table ( struct process, "processes" )
|
|
|
|
/**
|
|
* Declare a permanent process
|
|
*
|
|
* Permanent processes will be automatically added to the process list
|
|
* at initialisation time.
|
|
*/
|
|
#define __permanent_process __table_entry ( PERMANENT_PROCESSES, 01 )
|
|
|
|
#endif /* _IPXE_PROCESS_H */
|