Main Page   Compound List   File List   Compound Members   File Members  

MailBox Class Reference

#include <post.h>

List of all members.

Public Methods

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

Private Attributes

SynchListmessages


Constructor & Destructor Documentation

MailBox::MailBox  
 

Definition at line 54 of file post.cc.

References messages.

00055 { 
00056     messages = new SynchList(); 
00057 }

MailBox::~MailBox  
 

Definition at line 67 of file post.cc.

References messages.

00068 { 
00069     delete messages; 
00070 }


Member Function Documentation

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

Definition at line 124 of file post.cc.

References bcopy, Mail::data, DEBUG, DebugIsEnabled, MailHeader::length, Mail::mailHdr, messages, Mail::pktHdr, PrintHeader, and SynchList::Remove.

Referenced by PostOffice::Receive.

00125 { 
00126     DEBUG('n', "Waiting for mail in mailbox\n");
00127     Mail *mail = (Mail *) messages->Remove();   // remove message from list;
00128                                                 // will wait if list is empty
00129 
00130     *pktHdr = mail->pktHdr;
00131     *mailHdr = mail->mailHdr;
00132     if (DebugIsEnabled('n')) {
00133         printf("Got mail from mailbox: ");
00134         PrintHeader(*pktHdr, *mailHdr);
00135     }
00136     bcopy(mail->data, data, mail->mailHdr.length);
00137                                         // copy the message data into
00138                                         // the caller's buffer
00139     delete mail;                        // we've copied out the stuff we
00140                                         // need, we can now discard the message
00141 }

void MailBox::Put PacketHeader    pktHdr,
MailHeader    mailHdr,
char *    data
 

Definition at line 102 of file post.cc.

References SynchList::Append, and messages.

00103 { 
00104     Mail *mail = new Mail(pktHdr, mailHdr, data); 
00105 
00106     messages->Append((void *)mail);     // put on the end of the list of 
00107                                         // arrived messages, and wake up 
00108                                         // any waiters
00109 }


Member Data Documentation

SynchList* MailBox::messages [private]
 

Definition at line 90 of file post.h.

Referenced by Get, MailBox, Put, and ~MailBox.


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 09:54:57 2003 for nachos by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees