From: bernie Date: Tue, 19 Oct 2004 08:22:09 +0000 (+0000) Subject: msg_peek(): New function. X-Git-Tag: 1.0.0~1000 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=cb027f82e1f4375e6ca1080cf93cc0a480defe54;p=bertos.git msg_peek(): New function. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@241 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/kern/msg.h b/kern/msg.h index d9b06707..dbd73e83 100755 --- a/kern/msg.h +++ b/kern/msg.h @@ -18,6 +18,9 @@ /*#* *#* $Log$ + *#* Revision 1.4 2004/10/19 08:22:09 bernie + *#* msg_peek(): New function. + *#* *#* Revision 1.3 2004/08/25 14:12:09 rasky *#* Aggiornato il comment block dei log RCS *#* @@ -70,6 +73,15 @@ INLINE Msg* msg_get(MsgPort* port) return (Msg*)REMHEAD(&port->queue); } +/* Peek the first message in the queue of \a port, or NULL if the port is empty */ +INLINE Msg *msg_peek(MsgPort *port) +{ + if (ISLISTEMPTY(&port->queue)) + return NULL; + + return (Msg *)port->queue.head; +} + /*! Send back (reply) \a msg to its sender */ INLINE void msg_reply(Msg* msg) {