ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/client/3.0/FB30Events.pas
(Generate patch)

Comparing ibx/trunk/fbintf/client/3.0/FB30Events.pas (file contents):
Revision 216 by tony, Thu Mar 15 17:21:13 2018 UTC vs.
Revision 217 by tony, Fri Mar 16 10:27:26 2018 UTC

# Line 34 | Line 34 | unit FB30Events;
34   {$interfaces COM}
35   {$ENDIF}
36  
37 + { $DEFINE EVENTDEBUG}
38 +
39   interface
40  
41   uses
# Line 136 | Line 138 | begin
138    FOWner := aOwner;
139    FName := aName;
140    addRef;
141 +  {$IFDEF EVENTDEBUG} writeln(FName,' TEventhandlerInterface: Create'); {$ENDIF}
142   end;
143  
144   destructor TEventhandlerInterface.Destroy;
# Line 145 | Line 148 | begin
148   {$ELSE}
149    if assigned(FEventWaiting) then FEventWaiting.Free;
150   {$ENDIF}
151 + {$IFDEF EVENTDEBUG} writeln(FName,' TEventhandlerInterface: Destroy'); {$ENDIF}
152    inherited Destroy;
153   end;
154  
155   procedure TEventhandlerInterface.addRef;
156   begin
157    Inc(FRef);
158 < //  writeln(FName,': ref count = ',FRef);
158 > {$IFDEF EVENTDEBUG}  writeln(FName,': ref count = ',FRef);{$ENDIF}
159   end;
160  
161   function TEventhandlerInterface.release: Integer;
162   begin
163    Dec(FRef);
164 < //  writeln(FName,': ref count = ',FRef);
164 > {$IFDEF EVENTDEBUG}  writeln(FName,': ref count = ',FRef);{$ENDIF}
165    if FRef = 0 then Free;
166    Result := FRef;
167   end;
# Line 165 | Line 169 | end;
169   procedure TEventhandlerInterface.eventCallbackFunction(length: Cardinal;
170    events: BytePtr);
171   begin
172 < //  writeln('TEventhandlerInterface: Event Callback');
172 > {$IFDEF EVENTDEBUG}  writeln(FName,' TEventhandlerInterface: Event Callback'); {$ENDIF}
173    FOwner.FCriticalSection.Enter;
174    try
175      if FOwner.FResultBuffer <> nil then
# Line 173 | Line 177 | begin
177    finally
178      FOwner.FCriticalSection.Leave
179    end;
180 <  //writeln('TEventhandlerInterface: Set Event Called');
180 >  {$IFDEF EVENTDEBUG}writeln(FName,' TEventhandlerInterface: Set Event Called'); {$ENDIF}
181    {$IFDEF WINDOWS}
182    SetEvent(FEventHandler);
183    {$ELSE}
# Line 183 | Line 187 | end;
187  
188   procedure TEventhandlerInterface.WaitForEvent;
189   begin
190 < //  writeln('TEventhandlerInterface: Start Event Wait');
190 > {$IFDEF EVENTDEBUG}  writeln(FName,' TEventhandlerInterface: Start Event Wait'); {$ENDIF}
191    {$IFDEF WINDOWS}
192    WaitForSingleObject(FEventHandler,INFINITE);
193    {$ELSE}
194    FEventWaiting.WaitFor(INFINITE);
195    {$ENDIF}
196 < //  writeln('TEventhandlerInterface: Event Wait Ends');
196 > {$IFDEF EVENTDEBUG}  writeln(FName,' TEventhandlerInterface: Event Wait Ends');{$ENDIF}
197   end;
198  
199   procedure TEventhandlerInterface.CancelWait;
# Line 205 | Line 209 | end;
209  
210   procedure TEventHandlerThread.Execute;
211   begin
212 +  {$IFDEF EVENTDEBUG}  writeln('Event Handler Thread Starts'); {$ENDIF}
213    while not Terminated do
214    begin
215      FEventHandler.WaitForEvent;
216 +    {$IFDEF EVENTDEBUG}  writeln('Event Handler Ends Wait ',Terminated); {$ENDIF}
217  
218      if not Terminated  then
219        FOwner.EventSignaled;
220    end;
221 +  {$IFDEF EVENTDEBUG}  writeln('Event Handler Thread Ends'); {$ENDIF}
222   end;
223  
224   constructor TEventHandlerThread.Create(Owner: TFB30Events;
# Line 227 | Line 234 | procedure TEventHandlerThread.Terminate;
234   begin
235    inherited Terminate;
236    FEventHandler.CancelWait;
237 +  {$IFDEF EVENTDEBUG}  writeln('Event Handler Thread Cancelled'); {$ENDIF}
238   end;
239  
240    { TFB30Events }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines