Browse Source

--- Merging r15131 into '.':
U rtl/os2/system.pas
--- Merging r15139 into '.':
U rtl/os2/systhrd.inc

git-svn-id: branches/fixes_2_4@15247 -

Tomas Hajny 15 years ago
parent
commit
1505ab6721
2 changed files with 35 additions and 6 deletions
  1. 6 3
      rtl/os2/system.pas
  2. 29 3
      rtl/os2/systhrd.inc

+ 6 - 3
rtl/os2/system.pas

@@ -172,8 +172,8 @@ function Is_Prefetch (P: pointer): boolean;
     Is_Prefetch := false;
 
     MemSize := SizeOf (A);
-    DosQueryMem (P, MemSize, MemAttrs);
-    if (MemAttrs and (mfPag_Free or mfPag_Commit) <> 0)
+    if (DosQueryMem (P, MemSize, MemAttrs) = 0) and
+            (MemAttrs and (mfPag_Free or mfPag_Commit) <> 0)
                                                and (MemSize >= SizeOf (A)) then
      Move (P^, A [0], SizeOf (A))
     else
@@ -396,7 +396,10 @@ begin
      end;
    end;
 
-   if (Err <> 0) and (ExceptLevel < MaxExceptionLevel) then
+   if (Err <> 0) and (ExceptLevel < MaxExceptionLevel) 
+(* TH: The following line is necessary to avoid an endless loop *)
+                 and (Report^.Exception_Num < Xcpt_Process_Terminate)
+                                                                    then
     begin
      ExceptEIP [ExceptLevel] := Context^.Reg_EIP;
      ExceptError [ExceptLevel] := Err;

+ 29 - 3
rtl/os2/systhrd.inc

@@ -419,9 +419,8 @@ begin
 end;
 
 
-CONST INFINITE=-1;
-
 procedure IntRTLEventWaitFor (AEvent: PRTLEvent);
+CONST INFINITE=-1;
 begin
 {$WARNING TODO!}
 {
@@ -430,6 +429,30 @@ begin
 end;
 
 
+function SysTryEnterCriticalSection (var CS): longint;
+begin
+{$WARNING TODO!}
+end;
+
+
+procedure IntRTLEventWaitForTimeout (AEvent: PRTLEvent; Timeout: longint);
+begin
+{$WARNING TODO!}
+{
+  WaitForSingleObject(THANDLE(AEvent), Timeout);
+}
+end;
+
+
+procedure intRTLEventResetEvent (AEvent: PRTLEvent);
+begin
+{$WARNING TODO!}
+{
+  ResetEvent(THANDLE(AEvent));
+}
+end;
+
+
 
 var
   OS2ThreadManager: TThreadManager;
@@ -447,6 +470,7 @@ begin
     ResumeThread           :=@SysResumeThread;
     KillThread             :=@SysKillThread;
     ThreadSwitch           :=@SysThreadSwitch;
+    CloseThread		   :=@SysCloseThread;
     WaitForThreadTerminate :=@SysWaitForThreadTerminate;
     ThreadSetPriority      :=@SysThreadSetPriority;
     ThreadGetPriority      :=@SysThreadGetPriority;
@@ -454,6 +478,7 @@ begin
     InitCriticalSection    :=@SysInitCriticalSection;
     DoneCriticalSection    :=@SysDoneCriticalSection;
     EnterCriticalSection   :=@SysEnterCriticalSection;
+    TryEnterCriticalSection:=@SysTryEnterCriticalSection;
     LeaveCriticalSection   :=@SysLeaveCriticalSection;
     InitThreadVar          :=@SysInitThreadVar;
     RelocateThreadVar      :=@SysRelocateThreadVar;
@@ -467,9 +492,10 @@ begin
     RTLEventCreate         :=@IntRTLEventCreate;
     RTLEventDestroy        :=@IntRTLEventDestroy;
     RTLEventSetEvent       :=@IntRTLEventSetEvent;
+    RTLEventResetEvent     :=@intRTLEventResetEvent;
     RTLEventWaitFor        :=@IntRTLEventWaitFor;
+    RTLEventWaitForTimeout :=@intRTLEventWaitForTimeout;
     end;
   SetThreadManager (OS2ThreadManager);
 end;
 
-