Переглянути джерело

* fix test: TThread.WaitFor calls CheckSynchronize as well, so the thread needs to signal when it's done with removing entries from the queue

git-svn-id: trunk@47084 -
svenbarth 4 роки тому
батько
коміт
2f877218b4
1 змінених файлів з 8 додано та 0 видалено
  1. 8 0
      tests/tbs/tb0678.pp

+ 8 - 0
tests/tbs/tb0678.pp

@@ -29,6 +29,7 @@ begin
 end;
 end;
 
 
 var
 var
+  e: PRTLEvent;
   t1, t2: TTest;
   t1, t2: TTest;
 
 
 procedure TTestThread.Execute;
 procedure TTestThread.Execute;
@@ -46,17 +47,23 @@ begin
 
 
   { should remove only one }
   { should remove only one }
   RemoveQueuedEvents(@t1.DoTest);
   RemoveQueuedEvents(@t1.DoTest);
+
+  RTLEventSetEvent(e);
 end;
 end;
 
 
 var
 var
   t: TTestThread;
   t: TTestThread;
 begin
 begin
+  e := Nil;
   t := TTestThread.Create(True);
   t := TTestThread.Create(True);
   try
   try
+    e := RTLEventCreate;
+
     t1 := TTest.Create;
     t1 := TTest.Create;
     t2 := TTest.Create;
     t2 := TTest.Create;
 
 
     t.Start;
     t.Start;
+    RTLEventWaitFor(e);
     t.WaitFor;
     t.WaitFor;
 
 
     CheckSynchronize;
     CheckSynchronize;
@@ -67,6 +74,7 @@ begin
     t1.Free;
     t1.Free;
     t2.Free;
     t2.Free;
     t.Free;
     t.Free;
+    RTLEventDestroy(e);
   end;
   end;
 end.
 end.