LibCore: Simplify conditional logic in SharedCircularQueue

No functional changes.
This commit is contained in:
Jelle Raaijmakers 2022-04-27 12:41:18 +02:00 committed by Andreas Kling
parent 581e4dc25b
commit 50cf4e6e64
Notes: sideshowbarker 2024-07-17 11:28:27 +09:00

View file

@ -115,15 +115,12 @@ public:
ErrorOr<void, QueueStatus> result;
while (true) {
result = try_enqueue(to_insert);
if (result.is_error()) {
if (result.error() == QueueStatus::Full)
wait_function();
else
return Error::from_string_literal("Unexpected error while enqueuing"sv);
} else {
if (!result.is_error())
break;
}
if (result.error() != QueueStatus::Full)
return Error::from_string_literal("Unexpected error while enqueuing"sv);
wait_function();
}
return {};
}