There is a bug in wait notification function that greately reduces its usefulness.
It is present in all versions from 5.5 to 10.5
Let's look at the condition under which threads are woken or created
thread_group->queue.is_empty() means empty request queue, or that there is no work to do. So wakeup/create thread is done if there is no work to do, but not if there is some work to do.
It should actually be !thread_group->queue.is_empty() in that condition.
Historical note : this condition was initially implemented correctly, until commit 18c9b345b43b62b7c4dbac8ce0289c1c8103c2d1 (Threadpool -address review comments) removed the negation.