41 |
|
FEventSignalled: boolean; |
42 |
|
procedure EventsTest(Attachment: IAttachment); |
43 |
|
procedure EventReport(Sender: IEvents); |
44 |
+ |
procedure ShowEventReport; |
45 |
|
procedure ShowEventCounts(Intf: IEvents); |
46 |
|
public |
47 |
|
function TestTitle: AnsiString; override; |
67 |
|
EventHandler.AsyncWaitForEvent(EventReport); |
68 |
|
writeln(OutFile,'Async Wait Called'); |
69 |
|
sleep(500); |
70 |
+ |
CheckSynchronize; |
71 |
|
if FEventSignalled then |
72 |
|
begin |
73 |
|
writeln(OutFile,'First Event - usually ignored'); |
74 |
|
FEventSignalled := false; |
75 |
|
EventHandler.AsyncWaitForEvent(EventReport); |
76 |
|
sleep(100); |
77 |
+ |
CheckSynchronize; |
78 |
|
if FEventSignalled then |
79 |
|
begin |
80 |
|
writeln(OutFile,'Unexpected Event 1'); |
99 |
|
EventHandler.AsyncWaitForEvent(EventReport); |
100 |
|
writeln(OutFile,'Async Wait Called'); |
101 |
|
sleep(500); |
102 |
+ |
CheckSynchronize; |
103 |
|
if FEventSignalled then |
104 |
|
begin |
105 |
|
writeln(OutFile,'Deferred Events Caught'); |
118 |
|
FEventSignalled := false; |
119 |
|
writeln(OutFile,'Async Wait: Test Cancel'); |
120 |
|
EventHandler.AsyncWaitForEvent(EventReport); |
121 |
+ |
CheckSynchronize; |
122 |
|
writeln(OutFile,'Async Wait Called'); |
123 |
|
EventHandler.Cancel; |
124 |
|
writeln(OutFile,'Event Cancelled'); |
131 |
|
writeln(OutFile,'Event called - so Cancel failed'); |
132 |
|
|
133 |
|
writeln(OutFile,'Sync wait'); |
134 |
+ |
CheckSynchronize; |
135 |
|
Attachment.ExecImmediate([isc_tpb_write,isc_tpb_nowait,isc_tpb_concurrency],sqlEvent); |
136 |
|
EventHandler.WaitForEvent; |
137 |
|
writeln(OutFile,'Event Signalled'); |
138 |
|
ShowEventCounts(EventHandler); |
139 |
|
EventHandler := nil; |
140 |
+ |
CheckSynchronize; |
141 |
|
end; |
142 |
|
|
143 |
|
procedure TTest10.EventReport(Sender: IEvents); |
144 |
|
begin |
145 |
|
FEventSignalled := true; |
146 |
+ |
TThread.Synchronize(nil,ShowEventReport); |
147 |
+ |
end; |
148 |
+ |
|
149 |
+ |
procedure TTest10.ShowEventReport; |
150 |
+ |
begin |
151 |
|
writeln(OutFile,'Event Signalled'); |
152 |
|
end; |
153 |
|
|