a thread foreach stream