2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Send a message to a port.
8 #include "exec_intern.h"
9 #include <aros/libcall.h>
10 #include <exec/ports.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
17 AROS_LH2(void, PutMsg
,
20 AROS_LHA(struct MsgPort
*, port
, A0
),
21 AROS_LHA(struct Message
*, message
, A1
),
24 struct ExecBase
*, SysBase
, 61, Exec
)
27 Sends a message to a given message port. Messages are not copied
28 from one task to another but must lie in shared memory instead.
29 Therefore the owner of the message may generally not reuse it before
30 it is returned. But this depends on the two tasks sharing the message.
33 port - Pointer to messageport.
34 message - Pointer to message.
39 It is legal to send a message from within interrupts.
41 Messages may either trigger a signal at the owner of the messageport
42 or raise a software interrupt, depending on port->mp_Flags&PF_ACTION.
53 ******************************************************************************/
56 ASSERT_VALID_PTR(message
);
57 ASSERT_VALID_PTR(port
);
60 Messages may be sent from interrupts. Therefore the message list
61 of the message port must be protected with Disable().
65 /* Set the node type to NT_MESSAGE == sent message. */
66 message
->mn_Node
.ln_Type
=NT_MESSAGE
;
68 /* Add it to the message list. */
69 AddTail(&port
->mp_MsgList
,&message
->mn_Node
);
73 ASSERT_VALID_PTR(port
->mp_SigTask
);
75 /* And trigger the action. */
76 switch(port
->mp_Flags
& PF_ACTION
)
80 Signal((struct Task
*)port
->mp_SigTask
,1<<port
->mp_SigBit
);
84 /* Raise a software interrupt */
85 Cause((struct Interrupt
*)port
->mp_SoftInt
);