|
@@ -37,11 +37,18 @@ static LIST_HEAD ( run_queue );
|
37
|
37
|
* Add process to process list
|
38
|
38
|
*
|
39
|
39
|
* @v process Process
|
|
40
|
+ *
|
|
41
|
+ * It is safe to call process_add() multiple times; further calls will
|
|
42
|
+ * have no effect.
|
40
|
43
|
*/
|
41
|
44
|
void process_add ( struct process *process ) {
|
42
|
|
- DBGC ( process, "PROCESS %p starting\n", process );
|
43
|
|
- ref_get ( process->refcnt );
|
44
|
|
- list_add_tail ( &process->list, &run_queue );
|
|
45
|
+ if ( list_empty ( &process->list ) ) {
|
|
46
|
+ DBGC ( process, "PROCESS %p starting\n", process );
|
|
47
|
+ ref_get ( process->refcnt );
|
|
48
|
+ list_add_tail ( &process->list, &run_queue );
|
|
49
|
+ } else {
|
|
50
|
+ DBGC ( process, "PROCESS %p already started\n", process );
|
|
51
|
+ }
|
45
|
52
|
}
|
46
|
53
|
|
47
|
54
|
/**
|