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>
14 namespace cds { namespace OS {
16 /// Windows-specific wrappers
17 CDS_CXX11_INLINE_NAMESPACE namespace Win32 {
21 The implementation assumes that:
22 \li the system has no more than 64 logical processors;
23 \li processor IDs are in numerical order from 0 to N - 1, where N - count of processor in the system
25 struct CDS_EXPORT_API topology
27 # if _WIN32_WINNT >= 0x0601 // >= Windows 7
28 static unsigned int processor_count()
30 return ::GetActiveProcessorCount( ALL_PROCESSOR_GROUPS );
33 /// Logical processor count for the system
34 static unsigned int processor_count();
37 # if _WIN32_WINNT >= 0x0600 // >= Windows Vista
38 static unsigned int current_processor()
40 return ::GetCurrentProcessorNumber();
42 # else // < Windows Vista
43 /// Get current processor number
44 static unsigned int current_processor();
47 /// Synonym for \ref current_processor
48 static unsigned int native_current_processor()
50 return current_processor();
63 #ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
64 using Win32::topology;
66 }} // namespace cds::OS
70 #endif // #ifndef CDSLIB_OS_WIN_TOPOLOGY_H