mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 07:08:18 +00:00
More robust handling of suspend in entrypoint
First, calls to manage and dissolve signal contexts now check if the signal receiver was constructed. There is a small window during suspend where it is destructed before reconstructed again. Last, we ensure that processing of incoming signal was deblocked by the suspend signal before entering the suspend operation. This way we ensure already queued signal are handled.
This commit is contained in:
committed by
Norman Feske
parent
9fffb004b2
commit
7386c4e1d1
@ -74,7 +74,7 @@ void Entrypoint::_process_incoming_signals()
|
||||
[] () { warning("blocking canceled during signal processing"); }
|
||||
);
|
||||
|
||||
} while (!_suspended_callback);
|
||||
} while (!_suspended);
|
||||
|
||||
_suspend_dispatcher.destruct();
|
||||
_sig_rec.destruct();
|
||||
@ -100,6 +100,7 @@ void Entrypoint::_process_incoming_signals()
|
||||
void (*resumed_callback)() = _resumed_callback;
|
||||
_suspended_callback = nullptr;
|
||||
_resumed_callback = nullptr;
|
||||
_suspended = false;
|
||||
|
||||
resumed_callback();
|
||||
}
|
||||
@ -124,13 +125,17 @@ void Entrypoint::schedule_suspend(void (*suspended)(), void (*resumed)())
|
||||
|
||||
Signal_context_capability Entrypoint::manage(Signal_dispatcher_base &dispatcher)
|
||||
{
|
||||
return _sig_rec->manage(&dispatcher);
|
||||
/* _sig_rec is invalid for a small window in _process_incoming_signals */
|
||||
return _sig_rec.constructed() ? _sig_rec->manage(&dispatcher)
|
||||
: Signal_context_capability();
|
||||
}
|
||||
|
||||
|
||||
void Genode::Entrypoint::dissolve(Signal_dispatcher_base &dispatcher)
|
||||
{
|
||||
_sig_rec->dissolve(&dispatcher);
|
||||
/* _sig_rec is invalid for a small window in _process_incoming_signals */
|
||||
if (_sig_rec.constructed())
|
||||
_sig_rec->dissolve(&dispatcher);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user