3 #ifndef CDSLIB_OS_AIX_TOPOLOGY_H
4 #define CDSLIB_OS_AIX_TOPOLOGY_H
6 #ifndef CDSLIB_OS_TOPOLOGY_H
7 # error "<cds/os/topology.h> must be included instead"
10 #include <cds/os/details/fake_topology.h>
15 # include <sys/processor.h>
18 namespace cds { namespace OS {
20 /// IBM AIX specific wrappers
21 CDS_CXX11_INLINE_NAMESPACE namespace Aix {
25 The implementation assumes that the processor IDs are in numerical order
26 from 0 to N - 1, where N - count of processor in the system
28 struct topology: public OS::details::fake_topology
32 typedef OS::details::fake_topology base_class;
35 /// Logical processor count for the system
36 static unsigned int processor_count()
38 long nCount = ::sysconf(_SC_NPROCESSORS_ONLN);
41 return (unsigned int) nCount;
44 /// Get current processor number
46 Caveat: AIX has no "get current processor number" system call.
47 The function emulates "current processor number" using thread-specific data.
49 static unsigned int current_processor()
51 # if defined(_AIX53) && _AIX53 == 1
52 // AIX 5.3 has undocumented function mycpu() in sys/processor.h
55 return base_class::current_processor();
59 /// Synonym for \ref current_processor
60 static unsigned int native_current_processor()
62 return current_processor();
74 #ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
77 }} // namespace cds::OS
79 #endif // #ifndef CDSLIB_OS_AIX_TOPOLOGY_H