mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
add API pa_ncpus()
This commit is contained in:
parent
c0e4e5a868
commit
4dc1916467
3 changed files with 16 additions and 0 deletions
|
|
@ -2541,3 +2541,15 @@ void pa_reduce(unsigned *num, unsigned *den) {
|
|||
|
||||
pa_assert(pa_gcd(*num, *den) == 1);
|
||||
}
|
||||
|
||||
unsigned pa_ncpus(void) {
|
||||
long ncpus;
|
||||
|
||||
#ifdef _SC_NPROCESSORS_CONF
|
||||
ncpus = sysconf(_SC_NPROCESSORS_CONF);
|
||||
#else
|
||||
ncpus = 1;
|
||||
#endif
|
||||
|
||||
return ncpus <= 0 ? 1 : (unsigned) ncpus;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue