multithreading for meanshift