tac0S
Template Affectional Command Operating System
Public Member Functions | List of all members
MailBox Class Reference

Public Member Functions

 MailBox ()
 MailBox::MailBox Initialize a single mail box within the post office, so that it can receive incoming messages. More...
 
 ~MailBox ()
 MailBox::~MailBox De-allocate a single mail box within the post office. More...
 
void Put (PacketHeader pktHdr, MailHeader mailHdr, char *data)
 MailBox::Put Add a message to the mailbox. If anyone is waiting for message arrival, wake them up! More...
 
void Get (PacketHeader *pktHdr, MailHeader *mailHdr, char *data)
 MailBox::Get Get a message from a mailbox, parsing it into the packet header, mailbox header, and data. More...
 

Constructor & Destructor Documentation

MailBox::MailBox ( )

MailBox::MailBox Initialize a single mail box within the post office, so that it can receive incoming messages.

Just initialize a list of messages, representing the mailbox.

MailBox::~MailBox ( )

MailBox::~MailBox De-allocate a single mail box within the post office.

Just delete the mailbox, and throw away all the queued messages in the mailbox.

Member Function Documentation

void MailBox::Get ( PacketHeader pktHdr,
MailHeader mailHdr,
char *  data 
)

MailBox::Get Get a message from a mailbox, parsing it into the packet header, mailbox header, and data.

The calling thread waits if there are no messages in the mailbox.

Parameters
pktHdr– address to put: source, destination machine ID's
mailHdr– address to put: source, destination mailbox ID's
data– address to put: payload message data
void MailBox::Put ( PacketHeader  pktHdr,
MailHeader  mailHdr,
char *  data 
)

MailBox::Put Add a message to the mailbox. If anyone is waiting for message arrival, wake them up!

We need to reconstruct the Mail message (by concatenating the headers to the data), to simplify queueing the message on the SynchList.

Parameters
pktHdr– source, destination machine ID's
mailHdr– source, destination mailbox ID's
data– payload message data

The documentation for this class was generated from the following files: