Replaced num_thrads = 4 by thread::hardware_concurrency()