X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fmsg.h;h=0b6a556d3718c2e7e3e764e0d30eb3561f2e42dc;hb=0ae40112b9e0f2c42e89e14e9abe7d866c63d36a;hp=e4ee21f9b1ab5f2ae7a136aa5f7eaba2953aa257;hpb=791e167e053bdd9250d34a9a5ccae6ccde4d6679;p=bertos.git diff --git a/bertos/kern/msg.h b/bertos/kern/msg.h index e4ee21f9..0b6a556d 100644 --- a/bertos/kern/msg.h +++ b/bertos/kern/msg.h @@ -27,7 +27,7 @@ * the GNU General Public License. * * Copyright 2004 Develer S.r.l. (http://www.develer.com/) - * Copyright 1999,2001 Bernardo Innocenti + * Copyright 1999,2001 Bernie Innocenti * * --> * @@ -37,7 +37,7 @@ * * \version $Id$ * - * \author Bernardo Innocenti + * \author Bernie Innocenti * * \brief Simple inter-process messaging system * @@ -175,14 +175,13 @@ * \endcode */ - */ #ifndef KERN_MSG_H #define KERN_MSG_H -#include "event.h" -#include - +#include +#include +#include typedef struct MsgPort { @@ -214,7 +213,7 @@ typedef struct Msg * * \see msg_unlockPort() */ -INLINE void msg_lockPort(MsgPort *port) +INLINE void msg_lockPort(UNUSED_ARG(MsgPort *, port)) { proc_forbid(); } @@ -224,7 +223,7 @@ INLINE void msg_lockPort(MsgPort *port) * * \see msg_lockPort() */ -INLINE void msg_unlockPort(MsgPort *port) +INLINE void msg_unlockPort(UNUSED_ARG(MsgPort *, port)) { proc_permit(); } @@ -240,9 +239,9 @@ INLINE void msg_initPort(MsgPort *port, Event event) /** Queue \a msg into \a port, triggering the associated event */ INLINE void msg_put(MsgPort *port, Msg *msg) { - msg_portLock(port); + msg_lockPort(port); ADDTAIL(&port->queue, &msg->link); - msg_portUnlock(port); + msg_unlockPort(port); event_do(&port->event); } @@ -256,9 +255,9 @@ INLINE Msg *msg_get(MsgPort *port) { Msg *msg; - msg_portLock(port); - msg = (Msg *)REMHEAD(&port->queue); - msg_portUnlock(port); + msg_lockPort(port); + msg = (Msg *)list_remHead(&port->queue); + msg_unlockPort(port); return msg; } @@ -268,11 +267,11 @@ INLINE Msg *msg_peek(MsgPort *port) { Msg *msg; - msg_portLock(port); - msg = (Msg *)port->queue.head; - if (ISLISTEMPTY(&port->queue)) + msg_lockPort(port); + msg = (Msg *)port->queue.head.succ; + if (LIST_EMPTY(&port->queue)) msg = NULL; - msg_portUnlock(port); + msg_unlockPort(port); return msg; }