mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
avutil/cpu: Use HW_NCPUONLINE to detect # of online CPUs with OpenBSD
Signed-off-by: Brad Smith <brad@comstyle.com> Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
46f3ae8f67
commit
c8fb68ec52
@ -291,6 +291,12 @@ int av_cpu_count(void)
|
||||
DWORD_PTR proc_aff, sys_aff;
|
||||
if (GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff))
|
||||
nb_cpus = av_popcount64(proc_aff);
|
||||
#elif HAVE_SYSCTL && defined(HW_NCPUONLINE)
|
||||
int mib[2] = { CTL_HW, HW_NCPUONLINE };
|
||||
size_t len = sizeof(nb_cpus);
|
||||
|
||||
if (sysctl(mib, 2, &nb_cpus, &len, NULL, 0) == -1)
|
||||
nb_cpus = 0;
|
||||
#elif HAVE_SYSCTL && defined(HW_NCPU)
|
||||
int mib[2] = { CTL_HW, HW_NCPU };
|
||||
size_t len = sizeof(nb_cpus);
|
||||
|
Loading…
Reference in New Issue
Block a user