mirror of https://github.com/zrafa/xinu-avr.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
752 B
31 lines
752 B
/* resume.c - resume */ |
|
|
|
#include <xinu.h> |
|
|
|
/*------------------------------------------------------------------------ |
|
* resume - Unsuspend a process, making it ready |
|
*------------------------------------------------------------------------ |
|
*/ |
|
pri16 resume( |
|
pid32 pid /* ID of process to unsuspend */ |
|
) |
|
{ |
|
intmask mask; /* Saved interrupt mask */ |
|
struct procent *prptr; /* Ptr to process's table entry */ |
|
pri16 prio; /* Priority to return */ |
|
|
|
mask = disable(); |
|
if (isbadpid(pid)) { |
|
restore(mask); |
|
return (pri16)SYSERR; |
|
} |
|
prptr = &proctab[pid]; |
|
if (prptr->prstate != PR_SUSP) { |
|
restore(mask); |
|
return (pri16)SYSERR; |
|
} |
|
prio = prptr->prprio; /* Record priority to return */ |
|
ready(pid); |
|
restore(mask); |
|
return prio; |
|
}
|
|
|