2013-09-12 00:48:27 +02:00
|
|
|
/*
|
|
|
|
* \brief Kernel backend for asynchronous inter-process communication
|
|
|
|
* \author Martin Stein
|
|
|
|
* \date 2012-11-30
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2012-2013 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* core includes */
|
|
|
|
#include <kernel/signal_receiver.h>
|
|
|
|
|
2013-09-17 10:44:14 +02:00
|
|
|
using namespace Kernel;
|
2013-09-12 00:48:27 +02:00
|
|
|
|
2013-09-17 10:44:14 +02:00
|
|
|
|
2013-11-14 13:29:47 +01:00
|
|
|
/************************
|
|
|
|
** Signal_ack_handler **
|
|
|
|
************************/
|
|
|
|
|
|
|
|
Signal_ack_handler::~Signal_ack_handler()
|
|
|
|
{
|
|
|
|
if (_signal_context) { _signal_context->ack_handler(0); }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************
|
|
|
|
** Signal_handler **
|
|
|
|
********************/
|
|
|
|
|
2013-09-19 16:13:51 +02:00
|
|
|
void Signal_handler::_cancel_waiting()
|
2013-09-17 10:44:14 +02:00
|
|
|
{
|
2015-03-18 17:42:02 +01:00
|
|
|
if (_receiver) {
|
|
|
|
_receiver->_handler_cancelled(this);
|
|
|
|
_receiver = 0;
|
|
|
|
}
|
2013-09-17 10:44:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-14 13:29:47 +01:00
|
|
|
/***************************
|
|
|
|
** Signal_context_killer **
|
|
|
|
***************************/
|
|
|
|
|
2013-09-19 16:13:51 +02:00
|
|
|
void Signal_context_killer::_cancel_waiting()
|
2013-09-17 10:44:14 +02:00
|
|
|
{
|
2013-09-19 16:13:51 +02:00
|
|
|
if (_context) { _context->_killer_cancelled(); }
|
2013-09-17 10:44:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-14 13:29:47 +01:00
|
|
|
/********************
|
|
|
|
** Signal_context **
|
|
|
|
********************/
|
|
|
|
|
2013-09-17 10:44:14 +02:00
|
|
|
void Signal_context::_deliverable()
|
2013-09-12 00:48:27 +02:00
|
|
|
{
|
2013-11-14 13:29:47 +01:00
|
|
|
if (_submits) { _receiver->_add_deliverable(this); }
|
2013-09-12 00:48:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-06 00:12:43 +01:00
|
|
|
Signal_context::~Signal_context()
|
|
|
|
{
|
|
|
|
if (_killer) { _killer->_signal_context_kill_failed(); }
|
|
|
|
_receiver->_context_destructed(this);
|
|
|
|
}
|
2013-09-17 10:44:14 +02:00
|
|
|
|
2013-10-30 13:56:57 +01:00
|
|
|
|
2013-10-30 15:49:12 +01:00
|
|
|
Signal_context::Signal_context(Signal_receiver * const r, unsigned const imprint)
|
2013-10-30 13:56:57 +01:00
|
|
|
:
|
2013-11-15 12:42:07 +01:00
|
|
|
_deliver_fe(this),
|
|
|
|
_contexts_fe(this),
|
|
|
|
_receiver(r),
|
|
|
|
_imprint(imprint),
|
|
|
|
_submits(0),
|
|
|
|
_ack(1),
|
2013-12-06 00:12:43 +01:00
|
|
|
_killed(0),
|
2013-11-15 12:42:07 +01:00
|
|
|
_killer(0),
|
2013-11-14 13:29:47 +01:00
|
|
|
_ack_handler(&_default_ack_handler)
|
2013-10-30 13:56:57 +01:00
|
|
|
{
|
2013-12-06 11:53:08 +01:00
|
|
|
r->_add_context(this);
|
2013-10-30 13:56:57 +01:00
|
|
|
}
|