|
|
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:
9: /* size of shared memory segment */
10: #define SHRSEGSIZE sizeof(struct ShareRec)
11:
12: #define SHRSEGNAME "\\SHAREMEM\\SHARESEG.DAT" /* shared seg name */
13: #define CIRCBUFSIZE 20 /* size of circular buffer */
14: #define WAITFOREVER -1L /* no timeout if semaphore is owned */
15:
16: struct ShareRec {
1.1.1.2 ! root 17: ULONG fullsem; /* buffer access semaphore */
! 18: ULONG emptysem; /* buffer access semaphore */
! 19: ULONG mutexsem; /* buffer access semaphore */
1.1 root 20: int head; /* buffer write pointer */
21: int tail; /* buffer read pointer */
22: char CircBuffer[CIRCBUFSIZE]; /* circular buffer */
23: };
24:
25: /* definition of buffer full condition */
26: #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.