cleanup debug
[AROS.git] / rom / exec / getmsg.c
blob7236d116072280648c36f83ee4f446b785a78f24
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Get a message from a message port.
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <exec/execbase.h>
10 #include <exec/ports.h>
11 #include <aros/libcall.h>
12 #include <proto/exec.h>
14 /*****************************************************************************
16 NAME */
18 AROS_LH1(struct Message *, GetMsg,
20 /* SYNOPSIS */
21 AROS_LHA(struct MsgPort *, port, A0),
23 /* LOCATION */
24 struct ExecBase *, SysBase, 62, Exec)
26 /* FUNCTION
27 Get a message from a given messageport. This function doesn't wait
28 and returns NULL if the messageport is empty. Therefore it's
29 generally a good idea to WaitPort() or Wait() on the given port first.
31 INPUTS
32 port - Pointer to messageport
34 RESULT
35 Pointer to message removed from the port.
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 WaitPort(), PutMsg()
46 INTERNALS
48 ******************************************************************************/
50 AROS_LIBFUNC_INIT
52 struct Message *msg;
54 ASSERT_VALID_PTR(port);
56 /* Protect the message list. */
57 Disable();
59 /* Get first node. */
60 msg=(struct Message *)RemHead(&port->mp_MsgList);
62 /* All done. */
63 Enable();
65 ASSERT_VALID_PTR_OR_NULL(msg);
66 return msg;
67 AROS_LIBFUNC_EXIT
68 } /* GetMsg() */