Create or Get an instance of the settings singleton
| 41 | |
| 42 | // Create or Get an instance of the settings singleton |
| 43 | Settings *Settings::Instance() |
| 44 | { |
| 45 | if (!m_pInstance) { |
| 46 | // Create the actual instance of Settings only once |
| 47 | m_pInstance = new Settings; |
| 48 | const int machine_threads = std::max(2, omp_get_num_procs()); |
| 49 | m_pInstance->default_omp_threads = machine_threads; |
| 50 | m_pInstance->default_ff_threads = machine_threads; |
| 51 | m_pInstance->OMP_THREADS = machine_threads; |
| 52 | m_pInstance->FF_THREADS = machine_threads; |
| 53 | auto env_debug = std::getenv("LIBOPENSHOT_DEBUG"); |
| 54 | if (env_debug != nullptr) |
| 55 | m_pInstance->DEBUG_TO_STDERR = true; |
| 56 | } |
| 57 | |
| 58 | m_pInstance->ApplyOpenMPSettings(); |
| 59 | |
| 60 | return m_pInstance; |
| 61 | } |
nothing calls this directly
no test coverage detected