multithread logic