multithreaded computation of threshold