SOURCE FILE: protocol.h
/* A drastically over-simplified simulation of the contents of a
message packet. The fields are an id of a USER (0 or 1), and
a serial number for a packet. There's no field for the actual
message data - pretend it's there. :-) */
typedef struct infoType
{
int userID ;
int packetNum ;
} infoType ;
/* A structure for holding a packet buffer, along with all the
apparatus to regulate its use. USERS wait on empty to get
permission to write info. AGENTS signal on empty when they
have finished copying a packet out of a buffer, thus making it
available for a USER to copy another packet into it. Both
USERS and AGENTS wait on flagAccess to get permission to write
to the flag (called 'needService'). The thread that waits on
flagAccess is expected to signal on it when through. These
semaphores should be initialized to 1. */
typedef struct bufferType
{
infoType info ; /* the simulated packet */
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* Add any fields needed for things like semaphores
and/or variables used to synchronize threads that may
access this buffer concurrently. */
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
} bufferType ;