1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 22:37:36 +00:00

AudioServer: Block the mixer thread when there's nothing to do

Use a pthread_cond_t to have the ASMixer thread wait until a client has
connected and added a buffer queue to the "pending mixing" vector.

This solves the long-standing issue of the system "idling" at ~8% CPU.
This commit is contained in:
Andreas Kling 2019-12-22 21:33:33 +01:00
parent 4a8683ea68
commit a089125d0f
2 changed files with 19 additions and 15 deletions

View file

@ -96,9 +96,10 @@ public:
private:
Vector<NonnullRefPtr<ASBufferQueue>> m_pending_mixing;
pthread_mutex_t m_pending_mutex;
pthread_cond_t m_pending_cond;
RefPtr<CFile> m_device;
LibThread::Lock m_lock;
LibThread::Thread m_sound_thread;