Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[process] Make it safe to call process_add() multiple times
  • Loading branch information
Michael Brown committed Aug 10, 2009
1 parent 46073f1 commit 04878ef
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/core/process.c
Expand Up @@ -37,11 +37,18 @@ static LIST_HEAD ( run_queue );
* Add process to process list
*
* @v process Process
*
* It is safe to call process_add() multiple times; further calls will
* have no effect.
*/
void process_add ( struct process *process ) {
DBGC ( process, "PROCESS %p starting\n", process );
ref_get ( process->refcnt );
list_add_tail ( &process->list, &run_queue );
if ( list_empty ( &process->list ) ) {
DBGC ( process, "PROCESS %p starting\n", process );
ref_get ( process->refcnt );
list_add_tail ( &process->list, &run_queue );
} else {
DBGC ( process, "PROCESS %p already started\n", process );
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/include/gpxe/process.h
Expand Up @@ -47,6 +47,7 @@ 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;
}
Expand Down
1 change: 1 addition & 0 deletions src/net/infiniband.c
Expand Up @@ -802,6 +802,7 @@ static void ib_step ( struct process *process __unused ) {

/** Infiniband event queue process */
struct process ib_process __permanent_process = {
.list = LIST_HEAD_INIT ( ib_process.list ),
.step = ib_step,
};

Expand Down
1 change: 1 addition & 0 deletions src/net/netdevice.c
Expand Up @@ -625,5 +625,6 @@ static void net_step ( struct process *process __unused ) {

/** Networking stack process */
struct process net_process __permanent_process = {
.list = LIST_HEAD_INIT ( net_process.list ),
.step = net_step,
};
1 change: 1 addition & 0 deletions src/net/retry.c
Expand Up @@ -187,5 +187,6 @@ static void retry_step ( struct process *process __unused ) {

/** Retry timer process */
struct process retry_process __permanent_process = {
.list = LIST_HEAD_INIT ( retry_process.list ),
.step = retry_step,
};

0 comments on commit 04878ef

Please sign in to comment.