MB-11405 Wake only as many threads as ready tasks

+ If a thread has uncovered only one ready task then do not
  wake more threads, since current thread will suffice.
+ Only signal threads if they are sleeping.
+ cond_broadcast and wake all threads if we have more ready tasks
  than sleeping threads
+ Aggregate and signal threads to avoid repeated mutex contentions
Change-Id: Ic130b87c19a2c5cd9eb971078c9a40b3612b5da0