QPMS
Electromagnetic multiple scattering library and toolkit.
qpms
oshacks.h
Go to the documentation of this file.
1
4
#ifndef _QPMS_OSHACKS_H
5
#define _QPMS_OSHACKS_H
6
#include <unistd.h>
7
8
#ifdef _SC_NPROCESSORS_ONLN
9
static
inline
long
get_ncpus(
void
) {
10
return
sysconf(_SC_NPROCESSORS_ONLN);
11
}
12
#elif (0)
13
#include <sys/types.h>
14
#include <sys/sysctl.h>
15
static
inline
long
get_ncpus(
void
) {
16
int32_t ncpu;
17
size_t
len =
sizeof
(ncpu);
18
sysctlbyname(
"hw.physicalcpu"
, &ncpu, &len, NULL, 0);
19
return
ncpu;
20
}
21
#else
22
static
inline
long
get_ncpus(
void
) {
return
-1; }
23
#endif
24
25
26
#endif
// _QPMS_OSHACKS_H
Generated on Fri Jun 10 2022 12:43:00 for QPMS by
1.9.1