introduce for_each_thread() to replace the buggy while_each_thread() (fix)

fix a merge derp. pointed out by neobuddy89

Signed-off-by: Paul Reioux <reioux@gmail.com>

idea is taken here -
https://github.com/faux123/moto_x/commit/574b918179fc031047044595690ff293abbca0d1