cross-validation implemented by threads