|
|
1.1 root 1: /*
2: * This is a common include file used by examples share.c and shrchild.c.
3: * It contains the declaration of the shared memory segment.
4: */
5:
6: /* Convert an unsigned selector and an unsigned offset into a far pointer */
7:
8: #define GETSEGPTR(seg, off) ((char far *) (((long) seg << 16) + off))
9:
10: /* size of shared memory segment */
11: #define SHRSEGSIZE sizeof(struct ShareRec)
12:
13: #define SHRSEGNAME "\\SHAREMEM\\SHARESEG.DAT" /* shared seg name */
14: #define CIRCBUFSIZE 20 /* size of circular buffer */
15: #define TRUE 1
16: #define FALSE 0
17: #define WAITFOREVER -1L /* no timeout if semaphore is owned */
18:
19: struct ShareRec {
20: unsigned long fullsem; /* buffer access semaphore */
21: unsigned long emptysem; /* buffer access semaphore */
22: unsigned long mutexsem; /* buffer access semaphore */
23: int head; /* buffer write pointer */
24: int tail; /* buffer read pointer */
25: char CircBuffer[CIRCBUFSIZE]; /* circular buffer */
26: };
27:
28: /* definition of buffer full condition */
29: #define BUFFUL(p) ((p->head==p->tail-1)||((p->tail==0)&&(p->head==CIRCBUFSIZE-1)))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.