Kernel: Allow WorkQueue items allocation failures propagation

In most cases it's safe to abort the requested operation and go forward,
however, in some places it's not clear yet how to handle these failures,
therefore, we use the MUST() wrapper to force a kernel panic for now.
This commit is contained in:
Liav A 2022-03-06 22:07:04 +02:00 committed by Linus Groh
commit 1462211ccf
Notes: sideshowbarker 2024-07-17 11:38:45 +09:00
9 changed files with 75 additions and 19 deletions

View file

@ -151,7 +151,8 @@ void Console::process_control_message(ControlMessage message)
{
switch (message.event) {
case (u16)ControlEvent::DeviceAdd: {
g_io_work->queue([message, this]() -> void {
// FIXME: Do something sanely here if we can't allocate a work queue?
MUST(g_io_work->try_queue([message, this]() -> void {
u32 id = message.id;
if (id >= m_ports.size()) {
dbgln("Device provided an invalid port number {}. max_nr_ports: {}", id, m_ports.size());
@ -172,7 +173,7 @@ void Console::process_control_message(ControlMessage message)
.value = (u16)ControlMessage::Status::Success
};
write_control_message(ready_event);
});
}));
break;
}