home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / exec / replymsg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-09  |  2.3 KB  |  113 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: replymsg.c,v 1.7 1997/01/01 03:46:15 ldp Exp $
  4.     $Log: replymsg.c,v $
  5.     Revision 1.7  1997/01/01 03:46:15  ldp
  6.     Committed Amiga native (support) code
  7.  
  8.     Changed clib to proto
  9.  
  10.     Revision 1.6  1996/12/10 13:51:53  aros
  11.     Moved all #include's in the first column so makedepend can see it.
  12.  
  13.     Revision 1.5  1996/10/24 15:50:57  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.4  1996/08/13 13:56:08  digulla
  17.     Replaced AROS_LA by AROS_LHA
  18.     Replaced some AROS_LH*I by AROS_LH*
  19.     Sorted and added includes
  20.  
  21.     Revision 1.3  1996/08/01 17:41:18  digulla
  22.     Added standard header for all files
  23.  
  24.     Desc:
  25.     Lang: english
  26. */
  27. #include "exec_intern.h"
  28. #include <aros/libcall.h>
  29. #include <exec/ports.h>
  30. #include <proto/exec.h>
  31.  
  32. /*****************************************************************************
  33.  
  34.     NAME */
  35.  
  36.     AROS_LH1(void, ReplyMsg,
  37.  
  38. /*  SYNOPSIS */
  39.     AROS_LHA(struct Message *, message, A1),
  40.  
  41. /*  LOCATION */
  42.     struct ExecBase *, SysBase, 63, Exec)
  43.  
  44. /*  FUNCTION
  45.     Send a message back to where it came from. It's generally not
  46.     wise to access the fields of a message after it has been replied.
  47.  
  48.     INPUTS
  49.     message - a message got with GetMsg().
  50.  
  51.     RESULT
  52.  
  53.     NOTES
  54.  
  55.     EXAMPLE
  56.  
  57.     BUGS
  58.  
  59.     SEE ALSO
  60.     WaitPort(), GetMsg(), PutMsg()
  61.  
  62.     INTERNALS
  63.  
  64.     HISTORY
  65.  
  66. ******************************************************************************/
  67. {
  68.     AROS_LIBFUNC_INIT
  69.  
  70.     struct MsgPort *port;
  71.  
  72.     /* Protect the message against access by other tasks. */
  73.     Disable();
  74.  
  75.     /* Get replyport */
  76.     port=message->mn_ReplyPort;
  77.  
  78.     /* Not set? Only mark the message as no longer sent. */
  79.     if(port==NULL)
  80.     message->mn_Node.ln_Type=NT_FREEMSG;
  81.     else
  82.     {
  83.     /* Mark the message as replied */
  84.     message->mn_Node.ln_Type=NT_REPLYMSG;
  85.  
  86.     /* Add it to the replyport's list */
  87.     AddTail(&port->mp_MsgList,&message->mn_Node);
  88.  
  89.     /* And trigger the arrival action. */
  90.     switch(port->mp_Flags&PF_ACTION)
  91.     {
  92.         case PA_SIGNAL:
  93.         /* Send a signal */
  94.         Signal((struct Task *)port->mp_SigTask,1<<port->mp_SigBit);
  95.         break;
  96.  
  97.         case PA_SOFTINT:
  98.         /* Raise a software interrupt */
  99.         Cause((struct Interrupt *)port->mp_SoftInt);
  100.         break;
  101.  
  102.         case PA_IGNORE:
  103.         /* Do nothing */
  104.         break;
  105.     }
  106.     }
  107.  
  108.     /* All done */
  109.     Enable();
  110.     AROS_LIBFUNC_EXIT
  111. }
  112.  
  113.