# endif
#endif
-static std::thread::id s_MainThreadId = 0;
-static HINSTANCE s_DllInstance = NULL;
+static cds::OS::ThreadId s_MainThreadId = 0;
+static HINSTANCE s_DllInstance = nullptr;
#if _WIN32_WINNT < 0x0601
// For Windows below Windows 7
// Array of processor - cell relationship
// Array size is s_nProcessorCount
// s_arrProcessorCellRelationship[i] is the cell (the processor group) number for i-th processor
-// static unsigned int * s_arrProcessorCellRelationship = NULL;
+// static unsigned int * s_arrProcessorCellRelationship = nullptr;
static void discover_topology()
{
LPFN_GLPI glpi;
bool bDone = false;
- PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL;
- PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = NULL;
+ PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = nullptr;
+ PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = nullptr;
DWORD returnLength = 0;
DWORD logicalProcessorCount = 0;
DWORD numaNodeCount = 0;
s_nProcessorGroupCount = 1;
glpi = (LPFN_GLPI) GetProcAddress( GetModuleHandle("kernel32"), "GetLogicalProcessorInformation" );
- if (NULL == glpi) {
+ if ( glpi == nullptr ) {
return;
}
buffer = reinterpret_cast<PSYSTEM_LOGICAL_PROCESSOR_INFORMATION>( ::malloc( returnLength ) );
- if (NULL == buffer) {
+ if ( buffer == nullptr ) {
// allocation failed
return;
}
static void prepare_current_processor_call()
{
s_fnGetCurrentProcessorNumber = (fnGetCurrentProcessorNumber) GetProcAddress( GetModuleHandle("kernel32"), "GetCurrentProcessorNumber" );
- if ( s_fnGetCurrentProcessorNumber == NULL )
+ if ( s_fnGetCurrentProcessorNumber == nullptr )
s_fnGetCurrentProcessorNumber = (fnGetCurrentProcessorNumber) GetProcAddress( GetModuleHandle("ntdll"), "NtGetCurrentProcessorNumber" );
}
namespace cds { namespace OS { namespace Win32 {
unsigned int topology::current_processor()
{
- if ( s_fnGetCurrentProcessorNumber != NULL )
+ if ( s_fnGetCurrentProcessorNumber != nullptr )
return s_fnGetCurrentProcessorNumber();
return 0;
}
switch ( fdwReason ) {
case DLL_PROCESS_ATTACH:
s_DllInstance = hinstDLL;
- s_MainThreadId = std::this_thread::get_id();
+ s_MainThreadId = cds::OS::getCurrentThreadId();
#if _WIN32_WINNT < 0x0601
discover_topology();
#endif
case DLL_PROCESS_DETACH:
/*
#if _WIN32_WINNT < 0x0601
- if ( s_arrProcessorCellRelationship != NULL ) {
+ if ( s_arrProcessorCellRelationship != nullptr ) {
delete [] s_arrProcessorCellRelationship;
- s_arrProcessorCellRelationship = NULL;
+ s_arrProcessorCellRelationship = nullptr;
}
#endif
*/