From 839151eaaad24771892afaae6bac690e31e58384 Mon Sep 17 00:00:00 2001 From: Igor Pavlov <87184205+ip7z@users.noreply.github.com> Date: Thu, 12 Feb 2026 00:00:00 +0000 Subject: 26.00 --- CPP/Windows/System.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'CPP/Windows/System.h') diff --git a/CPP/Windows/System.h b/CPP/Windows/System.h index 0c80373..041a44d 100644 --- a/CPP/Windows/System.h +++ b/CPP/Windows/System.h @@ -15,6 +15,8 @@ namespace NWindows { namespace NSystem { +UInt32 GetNumberOfProcessors(); + #ifdef _WIN32 struct CCpuGroups @@ -103,6 +105,25 @@ struct CProcessAffinity return CountAffinity(systemAffinityMask); } + // it returns normilized number of threads + void Get_and_return_NumProcessThreads_and_SysThreads(UInt32 &numProcessThreads, UInt32 &numSysThreads) + { + UInt32 num1 = 0, num2 = 0; + if (Get()) + { + num1 = GetNumProcessThreads(); + num2 = GetNumSystemThreads(); + } + if (num1 == 0) + num1 = NSystem::GetNumberOfProcessors(); + if (num1 == 0) + num1 = 1; + if (num2 < num1) + num2 = num1; + numProcessThreads = num1; + numSysThreads = num2; + } + BOOL Get(); BOOL SetProcAffinity() const @@ -177,8 +198,6 @@ struct CProcessAffinity #endif // _WIN32 -UInt32 GetNumberOfProcessors(); - bool GetRamSize(size_t &size); // returns false, if unknown ram size unsigned long Get_File_OPEN_MAX(); -- cgit v1.2.3-55-g6feb