Revert " introduce for_each_thread() to replace the buggy while_each_thread() …"

This reverts commit e6aadc789012ab6caeb579e6a44b025d0b55642c.