|
|
1.1 root 1: /* signal.c - signal */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <proc.h>
6: #include <q.h>
7: #include <sem.h>
8:
9: /*------------------------------------------------------------------------
10: * signal -- signal a semaphore, releasing one waiting process
11: *------------------------------------------------------------------------
12: */
13: SYSCALL signal(sem)
14: register int sem;
15: {
16: register struct sentry *sptr;
17: PStype ps;
18:
19: disable(ps);
20: if (isbadsem(sem) || (sptr= &semaph[sem])->sstate==SFREE) {
21: restore(ps);
22: return(SYSERR);
23: }
24: if ((sptr->semcnt++) < 0)
25: ready(getfirst(sptr->sqhead), RESCHYES);
26: restore(ps);
27: return(OK);
28: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.