1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

LibCore: Remove awkward EventLoop::wake_once() API

This was used in exactly one place, to avoid sending multiple
CustomEvents to the enqueuer thread in Audio::ConnectionToServer.

Instead of this, we now just send a CustomEvent and wake the enqueuer
thread. If it wakes up and has multiple CustomEvents, they get delivered
and ignored in no time anyway. Since they only get ignored if there's
no work to be done, this seems harmless.
This commit is contained in:
Andreas Kling 2023-04-23 18:20:38 +02:00
parent 896d1e4f42
commit 9601b516b8
3 changed files with 7 additions and 31 deletions

View file

@ -69,7 +69,8 @@ ErrorOr<void> ConnectionToServer::async_enqueue(FixedArray<Sample>&& samples)
update_good_sleep_time();
m_user_queue->append(move(samples));
// Wake the background thread to make sure it starts enqueuing audio.
m_enqueuer_loop->wake_once(*this, 0);
m_enqueuer_loop->post_event(*this, make<Core::CustomEvent>(0));
m_enqueuer_loop->wake();
async_start_playback();
return {};