jbaldwin / libcoro

C++20 coroutine library
Apache License 2.0
596 stars 61 forks source link

coro::thread_pool high cpu usage when tasks < threads #265

Closed jbaldwin closed 4 months ago

jbaldwin commented 5 months ago

The check for m_size > 0 was keeping threads awake in a spin state until all tasks completed. This correctl now uses m_queue.size() behind the lock to correctly only wake up threads on the condition variable when tasks are waiting to be processed.

Closes #262