3 #ifndef CDSLIB_OS_WIN_TOPOLOGY_H
4 #define CDSLIB_OS_WIN_TOPOLOGY_H
6 #ifndef CDSLIB_OS_TOPOLOGY_H
7 # error "<cds/os/topology.h> must be included instead"
10 #include <cds/details/defs.h>
16 namespace cds { namespace OS {
18 /// Windows-specific wrappers
19 CDS_CXX11_INLINE_NAMESPACE namespace Win32 {
23 The implementation assumes that:
24 \li the system has no more than 64 logical processors;
25 \li processor IDs are in numerical order from 0 to N - 1, where N - count of processor in the system
27 struct CDS_EXPORT_API topology
29 # if _WIN32_WINNT >= 0x0601 // >= Windows 7
30 static unsigned int processor_count()
32 return ::GetActiveProcessorCount( ALL_PROCESSOR_GROUPS );
35 /// Logical processor count for the system
36 static unsigned int processor_count();
39 # if _WIN32_WINNT >= 0x0600 // >= Windows Vista
40 static unsigned int current_processor()
42 return ::GetCurrentProcessorNumber();
44 # else // < Windows Vista
45 /// Get current processor number
46 static unsigned int current_processor();
49 /// Synonym for \ref current_processor
50 static unsigned int native_current_processor()
52 return current_processor();
65 #ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
66 using Win32::topology;
68 }} // namespace cds::OS
72 #endif // #ifndef CDSLIB_OS_WIN_TOPOLOGY_H