mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 10:01:57 +00:00
parent
9c027fd9bd
commit
6f377ec4c5
43
repos/base-hw/src/core/include/kernel/fifo.h
Normal file
43
repos/base-hw/src/core/include/kernel/fifo.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* \brief Queue with first-in first-out semantics
|
||||||
|
* \author Martin Stein
|
||||||
|
* \date 2012-11-30
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _KERNEL__FIFO_H_
|
||||||
|
#define _KERNEL__FIFO_H_
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
|
#include <util/fifo.h>
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queue with first-in first-out semantics
|
||||||
|
*
|
||||||
|
* \param T queue element type
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
class Fifo : public Genode::Fifo<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call function 'f' of type 'void (QT *)' for each queue element
|
||||||
|
*/
|
||||||
|
template <typename F> void for_each(F f)
|
||||||
|
{
|
||||||
|
typedef Genode::Fifo<T> B;
|
||||||
|
for (T * e = B::head(); e; e = e->B::Element::next()) { f(e); }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _KERNEL__FIFO_H_ */
|
@ -14,10 +14,8 @@
|
|||||||
#ifndef _KERNEL__IPC_NODE_H_
|
#ifndef _KERNEL__IPC_NODE_H_
|
||||||
#define _KERNEL__IPC_NODE_H_
|
#define _KERNEL__IPC_NODE_H_
|
||||||
|
|
||||||
/* Genode includes */
|
|
||||||
#include <util/fifo.h>
|
|
||||||
|
|
||||||
/* core includes */
|
/* core includes */
|
||||||
|
#include <kernel/fifo.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace Kernel
|
namespace Kernel
|
||||||
@ -45,7 +43,7 @@ class Kernel::Ipc_node
|
|||||||
|
|
||||||
class Message_buf;
|
class Message_buf;
|
||||||
|
|
||||||
typedef Genode::Fifo<Message_buf> Message_fifo;
|
typedef Kernel::Fifo<Message_buf> Message_fifo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the buffer for incoming or outgoing messages
|
* Describes the buffer for incoming or outgoing messages
|
||||||
|
Loading…
x
Reference in New Issue
Block a user