home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pmos2002.zip / DEF / MAILBOXE.DEF < prev    next >
Text File  |  1996-09-30  |  2KB  |  44 lines

  1. DEFINITION MODULE Mailboxes;
  2.  
  3.         (********************************************************)
  4.         (*                                                      *)
  5.         (*      Mailboxes for intertask communication           *)
  6.         (*                                                      *)
  7.         (*  Programmer:         P. Moylan                       *)
  8.         (*  Last edited:        30 September 1996               *)
  9.         (*  Status:             Working                         *)
  10.         (*                                                      *)
  11.         (********************************************************)
  12.  
  13. FROM SYSTEM IMPORT
  14.     (* type *)  ADDRESS;
  15.  
  16. TYPE Mailbox;           (* is private *)
  17.  
  18. PROCEDURE CreateMailbox (LengthLimit: CARDINAL): Mailbox;
  19.  
  20.     (* Creates a new mailbox.  LengthLimit is the maximum number of     *)
  21.     (* characters in a single message.  (A limit is needed so that a    *)
  22.     (* task reading the mailbox knows how much space to allocate.)      *)
  23.  
  24. PROCEDURE SendMessage (MB: Mailbox;  messageptr: ADDRESS;
  25.                                         length: CARDINAL): BOOLEAN;
  26.  
  27.     (* Copies a string, specified by its address and length, into the   *)
  28.     (* specified mailbox.  Returns TRUE if successful, and FALSE if the *)
  29.     (* message is too long or the mailbox does not exist.               *)
  30.  
  31. PROCEDURE ReceiveMessage (MB: Mailbox;  VAR (*OUT*) message: ARRAY OF CHAR;
  32.                                         TimeLimit: CARDINAL): CARDINAL;
  33.  
  34.     (* Returns the next message (after waiting if necessary) from       *)
  35.     (* mailbox MB.  TimeLimit is a timeout value in milliseconds.       *)
  36.     (* (Specify TimeLimit=0 for infinite patience.)  The function       *)
  37.     (* return value is the message length; this is zero if no message   *)
  38.     (* was obtained, either because of a faulty mailbox or because of   *)
  39.     (* timeout.  Note: it is also possible to have a genuine message of *)
  40.     (* zero length.                                                     *)
  41.  
  42. END Mailboxes.
  43.  
  44.