Multithreaded operations within loops