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

This reverts commit 99cf9b23dffe3e35952feabe9cfeb9a107a7ab12.