More efficient threads loop