better way to set m_max_threads