3 #ifndef CDSLIB_OS_SUNOS_TOPOLOGY_H
4 #define CDSLIB_OS_SUNOS_TOPOLOGY_H
6 #ifndef CDSLIB_OS_TOPOLOGY_H
7 # error "<cds/os/topology.h> must be included instead"
10 #include <sys/processor.h>
13 namespace cds { namespace OS {
15 /// Sun Solaris-specific wrappers
16 CDS_CXX11_INLINE_NAMESPACE namespace Sun {
20 The implementation assumes that the processor IDs are in numerical order
21 from 0 to N - 1, where N - count of processor in the system
24 /// Logical processor count for the system
25 static unsigned int processor_count()
27 // Maybe, _SC_NPROCESSORS_ONLN? But _SC_NPROCESSORS_ONLN may change dynamically...
28 long nCount = ::sysconf(_SC_NPROCESSORS_CONF);
31 return (unsigned int) nCount;
34 /// Get current processor number
35 static unsigned int current_processor()
40 /// Synonym for \ref current_processor
41 static unsigned int native_current_processor()
43 return current_processor();
55 #ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
58 }} // namespace cds::OS
60 #endif // #ifndef CDSLIB_OS_SUNOS_TOPOLOGY_H