Przeglądaj źródła

* GetCPUCount implementation for OS/2 added

git-svn-id: trunk@23233 -
Tomas Hajny 12 lat temu
rodzic
commit
e256311188
2 zmienionych plików z 18 dodań i 0 usunięć
  1. 1 0
      rtl/os2/system.pas
  2. 17 0
      rtl/os2/systhrd.inc

+ 1 - 0
rtl/os2/system.pas

@@ -28,6 +28,7 @@ interface
 
 {$DEFINE OS2EXCEPTIONS}
 {$define DISABLE_NO_THREAD_MANAGER}
+{$DEFINE HAS_GETCPUCOUNT}
 
 {$I systemh.inc}
 

+ 17 - 0
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;