Listing 2

#define TRUE         1
#define FALSE        0
#define GLOB_NAME  "Common Window"   /* Parameters of global window   */
#define GLOB_HEIGHT  6
#define GLOB_WIDTH  80
#define EPSILON ((double) 0.0000001) /* Smallest interval of interest */

#define NUMPRC              4      /* Number of processes to simulate */
#define MASTER      (2*NUMPRC)     /* dummy node" claimed by master   */
#define TERMINATE (2*NUMPRC+1)     /* "dummy node" waiting in main()  */
#define NUM_MSGS  (2*NUMPRC+2)     /*  Total number of messages slots */
#define REQ_DESQVIEW 0x201         /* Desqview 2.01 or later required */

typedef unsigned long DESQ_HAN;    /* Many DV functions use 32 bits   */

typedef struct monitor {
   DESQ_HAN sem_han;               /* Mailbox belongs to the monitor */
   int sent [NUM_MSGS];            /* Count of message pending       */
   double value [NUM_MSGS];        /* Actual message data            */
   } MONITOR;                      /* This is the keyword to use     */