2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Signal-source interface
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2010-02-03
|
|
|
|
*
|
2016-01-14 12:22:00 +00:00
|
|
|
* This file is only included by 'pd_session/pd_session.h' and relies
|
|
|
|
* on the headers included there. It is a separate header file to make it
|
|
|
|
* easily replaceable by a platform-specific implementation.
|
2011-12-22 15:19:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 20:44:47 +00:00
|
|
|
* Copyright (C) 2010-2013 Genode Labs GmbH
|
2011-12-22 15:19:25 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
2016-01-14 12:22:00 +00:00
|
|
|
#ifndef _INCLUDE__SIGNAL_SOURCE__SIGNAL_SOURCE_H_
|
|
|
|
#define _INCLUDE__SIGNAL_SOURCE__SIGNAL_SOURCE_H_
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2016-01-14 12:22:00 +00:00
|
|
|
namespace Genode { class Signal_source; }
|
2015-03-04 20:12:14 +00:00
|
|
|
|
|
|
|
/**
|
2016-01-14 12:22:00 +00:00
|
|
|
* Blocking part of the PD-session interface
|
2015-03-04 20:12:14 +00:00
|
|
|
*
|
2015-03-20 16:50:41 +00:00
|
|
|
* The blocking 'wait_for_signal()' operation cannot be part of the
|
2016-01-14 12:22:00 +00:00
|
|
|
* PD-session interface because otherwise, context allocations or
|
2015-03-04 20:12:14 +00:00
|
|
|
* signal submissions would not be possible while blocking for signals.
|
2016-01-14 12:22:00 +00:00
|
|
|
* Therefore, the blocking part is implemented as a kernel-specific
|
|
|
|
* special case.
|
2015-03-04 20:12:14 +00:00
|
|
|
*/
|
|
|
|
struct Genode::Signal_source
|
|
|
|
{
|
|
|
|
class Signal
|
2011-12-22 15:19:25 +00:00
|
|
|
{
|
2015-03-04 20:12:14 +00:00
|
|
|
private:
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
long _imprint;
|
|
|
|
int _num;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
public:
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2016-01-14 12:22:00 +00:00
|
|
|
Signal(long imprint, int num) : _imprint(imprint), _num(num) { }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
Signal() : _imprint(0), _num(0) { }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
long imprint() { return _imprint; }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
int num() { return _num; }
|
|
|
|
};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
virtual ~Signal_source() { }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Wait for signal
|
|
|
|
*/
|
|
|
|
virtual Signal wait_for_signal() = 0;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/*********************
|
|
|
|
** RPC declaration **
|
|
|
|
*********************/
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
GENODE_RPC(Rpc_wait_for_signal, Signal, wait_for_signal);
|
|
|
|
GENODE_RPC_INTERFACE(Rpc_wait_for_signal);
|
|
|
|
};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2016-01-14 12:22:00 +00:00
|
|
|
#endif /* _INCLUDE__SIGNAL_SOURCE__SIGNAL_SOURCE_H_ */
|