Add defines for test loop limits
Switched blocking threads to use ring_queue and limit the number created