use thread-pool to calculate distances of each data point pair