Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[process] Add PROC_INIT() for initialising static processes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Aug 16, 2019
1 parent c63ef42 commit 6df2c6a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/include/ipxe/process.h
Expand Up @@ -122,6 +122,18 @@ extern void process_add ( struct process *process );
extern void process_del ( struct process *process );
extern void step ( void );

/**
* Initialise a static process
*
* @v process Process
* @v desc Process descriptor
*/
#define PROC_INIT( _process, _desc ) { \
.list = LIST_HEAD_INIT ( (_process).list ), \
.desc = (_desc), \
.refcnt = NULL, \
}

/**
* Initialise process without adding to process list
*
Expand Down Expand Up @@ -180,11 +192,7 @@ process_running ( struct process *process ) {
*/
#define PERMANENT_PROCESS( name, step ) \
static struct process_descriptor name ## _desc = PROC_DESC_PURE ( step ); \
struct process name __permanent_process = { \
.list = LIST_HEAD_INIT ( name.list ), \
.desc = & name ## _desc, \
.refcnt = NULL, \
};
struct process name __permanent_process = PROC_INIT ( name, & name ## _desc );

/**
* Find debugging colourisation for a process
Expand Down

0 comments on commit 6df2c6a

Please sign in to comment.