From e256311188639ff8e4b1836218aa2720fa241958 Mon Sep 17 00:00:00 2001 From: Tomas Hajny Date: Thu, 27 Dec 2012 22:23:03 +0000 Subject: [PATCH] * GetCPUCount implementation for OS/2 added git-svn-id: trunk@23233 - --- rtl/os2/system.pas | 1 + rtl/os2/systhrd.inc | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/rtl/os2/system.pas b/rtl/os2/system.pas index 8918bc9447..115f982d1a 100644 --- a/rtl/os2/system.pas +++ b/rtl/os2/system.pas @@ -28,6 +28,7 @@ interface {$DEFINE OS2EXCEPTIONS} {$define DISABLE_NO_THREAD_MANAGER} +{$DEFINE HAS_GETCPUCOUNT} {$I systemh.inc} diff --git a/rtl/os2/systhrd.inc b/rtl/os2/systhrd.inc index 7e9a5dc867..d60ee5bd4f 100644 --- a/rtl/os2/systhrd.inc +++ b/rtl/os2/systhrd.inc @@ -170,6 +170,10 @@ function DosQuerySysState (EntityList, EntityLevel, PID, TID: cardinal; var Buffer; BufLen: cardinal): cardinal; cdecl; external 'DOSCALLS' index 368; +function DosQuerySysInfo (First, Last: cardinal; var Buf; BufSize: cardinal): + cardinal; cdecl; + external 'DOSCALLS' index 348; + {***************************************************************************** @@ -707,6 +711,19 @@ begin end; +{$DEFINE HAS_GETCPUCOUNT} +function GetCPUCount: LongWord; +const + svNumProcessors = 26; +var + ProcNum: cardinal; +begin + GetCPUCount := 1; + if DosQuerySysInfo (svNumProcessors, svNumProcessors, ProcNum, + SizeOf (ProcNum)) = 0 then + GetCPUCount := ProcNum; +end; + var OS2ThreadManager: TThreadManager;