diff options
| author | Michael Brown | 2007-06-08 17:33:24 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-06-08 17:33:24 +0200 |
| commit | 6f0a6c09db3b714849e3f84dabd3ad9ee9041607 (patch) | |
| tree | 67b0a5d66d2ea9a0508c36ca0a4eaaffa3045725 /src/core/process.c | |
| parent | Should call ftp_done() if constructor fails. (diff) | |
| parent | Conflicts with native asn1.c (diff) | |
| download | ipxe-6f0a6c09db3b714849e3f84dabd3ad9ee9041607.tar.gz ipxe-6f0a6c09db3b714849e3f84dabd3ad9ee9041607.tar.xz ipxe-6f0a6c09db3b714849e3f84dabd3ad9ee9041607.zip | |
Merge branch 'master' into mcb-tcp-xfer
Diffstat (limited to 'src/core/process.c')
| -rw-r--r-- | src/core/process.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/core/process.c b/src/core/process.c index c087f16d8..0583a398c 100644 --- a/src/core/process.c +++ b/src/core/process.c @@ -31,25 +31,43 @@ static LIST_HEAD ( run_queue ); /** - * Add process to run queue + * Add process to process list * * @v process Process */ -void schedule ( struct process *process ) { +void process_add ( struct process *process ) { + ref_get ( process->refcnt ); list_add_tail ( &process->list, &run_queue ); } /** + * Remove process from process list + * + * @v process Process + * + * It is safe to call process_del() multiple times; further calls will + * have no effect. + */ +void process_del ( struct process *process ) { + if ( ! list_empty ( &process->list ) ) { + list_del ( &process->list ); + INIT_LIST_HEAD ( &process->list ); + ref_put ( process->refcnt ); + } +} + +/** * Single-step a single process * - * This removes the first process from the run queue and executes a - * single step of that process. + * This executes a single step of the first process in the run queue, + * and moves the process to the end of the run queue. */ void step ( void ) { struct process *process; list_for_each_entry ( process, &run_queue, list ) { list_del ( &process->list ); + list_add_tail ( &process->list, &run_queue ); process->step ( process ); break; } |
