mirror of
https://github.com/xcat2/xNBA.git
synced 2024-11-26 19:29:04 +00:00
[process] Add process_running()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
da123eada4
commit
25447294d5
@ -42,7 +42,7 @@ static LIST_HEAD ( run_queue );
|
||||
* have no effect.
|
||||
*/
|
||||
void process_add ( struct process *process ) {
|
||||
if ( list_empty ( &process->list ) ) {
|
||||
if ( ! process_running ( process ) ) {
|
||||
DBGC ( process, "PROCESS %p starting\n", process );
|
||||
ref_get ( process->refcnt );
|
||||
list_add_tail ( &process->list, &run_queue );
|
||||
@ -60,7 +60,7 @@ void process_add ( struct process *process ) {
|
||||
* have no effect.
|
||||
*/
|
||||
void process_del ( struct process *process ) {
|
||||
if ( ! list_empty ( &process->list ) ) {
|
||||
if ( process_running ( process ) ) {
|
||||
DBGC ( process, "PROCESS %p stopping\n", process );
|
||||
list_del ( &process->list );
|
||||
INIT_LIST_HEAD ( &process->list );
|
||||
|
@ -66,6 +66,17 @@ process_init ( struct process *process,
|
||||
process_add ( process );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if process is running
|
||||
*
|
||||
* @v process Process
|
||||
* @ret running Process is running
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
process_running ( struct process *process ) {
|
||||
return ( ! list_empty ( &process->list ) );
|
||||
}
|
||||
|
||||
/** Permanent process table */
|
||||
#define PERMANENT_PROCESSES __table ( struct process, "processes" )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user