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