* the GNU General Public License.
*
* Copyright 2004 Develer S.r.l. (http://www.develer.com/)
- * Copyright 1999,2001 Bernardo Innocenti <bernie@develer.com>
+ * Copyright 1999,2001 Bernie Innocenti <bernie@codewiz.org>
*
* -->
*
*
* \version $Id$
*
- * \author Bernardo Innocenti <bernie@develer.com>
+ * \author Bernie Innocenti <bernie@codewiz.org>
*
* \brief Simple inter-process messaging system
*
* \endcode
*/
- */
#ifndef KERN_MSG_H
#define KERN_MSG_H
-#include "event.h"
-#include <mware/list.h>
-
+#include <mware/event.h>
+#include <struct/list.h>
+#include <kern/proc.h>
typedef struct MsgPort
{
*
* \see msg_unlockPort()
*/
-INLINE void msg_lockPort(MsgPort *port)
+INLINE void msg_lockPort(UNUSED_ARG(MsgPort *, port))
{
proc_forbid();
}
*
* \see msg_lockPort()
*/
-INLINE void msg_unlockPort(MsgPort *port)
+INLINE void msg_unlockPort(UNUSED_ARG(MsgPort *, port))
{
proc_permit();
}
/** 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);
}
{
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;
}
{
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;
}