Extracted AdaptiveSemaphore

Might be useful outside the ProducerThrottlingQueue…

Also made some format changes