Fix races in queue limiting

It is quite common for the thread pool to keep the thread in use after
the last job has finished or the thread is allocated but was not
enqueued from the unprocessed thread. This causes the counting algorithm
to reject calls when it should accept them.

This changes the scheme to count the actual calls that are running and
queued and reject only when the total is over the limit thus including
calls that are about to be allocated correctly.

Change-Id: I16bd7a5955d0c0dd619680aeaac146eb278b3acd
Signed-off-by: Saggi Mizrahi <ficoos@gmail.com>