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>
13 namespace cds { namespace OS {
15 /// Windows-specific wrappers
16 CDS_CXX11_INLINE_NAMESPACE namespace Win32 {
20 The implementation assumes that:
21 \li the system has no more than 64 logical processors;
22 \li processor IDs are in numerical order from 0 to N - 1, where N - count of processor in the system
24 struct CDS_EXPORT_API topology
26 # if _WIN32_WINNT >= 0x0601 // >= Windows 7
27 static unsigned int processor_count()
29 return ::GetActiveProcessorCount( ALL_PROCESSOR_GROUPS );
32 /// Logical processor count for the system
33 static unsigned int processor_count();
36 # if _WIN32_WINNT >= 0x0600 // >= Windows Vista
37 static unsigned int current_processor()
39 return ::GetCurrentProcessorNumber();
41 # else // < Windows Vista
42 /// Get current processor number
43 static unsigned int current_processor();
46 /// Synonym for \ref current_processor
47 static unsigned int native_current_processor()
49 return current_processor();
62 #ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
63 using Win32::topology;
65 }} // namespace cds::OS
69 #endif // #ifndef CDSLIB_OS_WIN_TOPOLOGY_H