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 45 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 47 by tony, Mon Jan 9 15:31:51 2017 UTC

# Line 84 | Line 84 | type
84  
85      {IEvents}
86      procedure WaitForEvent;
87 <    procedure AsyncWaitForEvent(EventHandler: TEventHandler);
87 >    procedure AsyncWaitForEvent(EventHandler: TEventHandler); override;
88    end;
89  
90   implementation
# Line 125 | Line 125 | begin
125   {$ENDIF}
126    inherited Create;
127   {$IFDEF WINDOWS}
128 <  FEventHandler := CreateEvent(PSa,false,true,nil);
128 >  FEventHandler := CreateEvent(PSa,false,false,nil);
129   {$ELSE}
130    CreateGuid(GUID);
131    FEventWaiting := TEventObject.Create(PSa,false,false,GUIDToString(GUID));
# Line 166 | Line 166 | begin
166    try
167      if FOwner.FResultBuffer <> nil then
168        Move(events[0], FOwner.FResultBuffer[0], Length);
169    {$IFDEF WINDOWS}
170    SetEvent(FEventHandler);
171    {$ELSE}
172    FEventWaiting.SetEvent;
173    {$ENDIF}
169    finally
170      FOwner.FCriticalSection.Leave
171    end;
172 + //  writeln('Set Event');
173 +  {$IFDEF WINDOWS}
174 +  SetEvent(FEventHandler);
175 +  {$ELSE}
176 +  FEventWaiting.SetEvent;
177 +  {$ENDIF}
178   end;
179  
180   procedure TEventhandlerInterface.WaitForEvent;
# Line 183 | Line 184 | begin
184    {$ELSE}
185    FEventWaiting.WaitFor(INFINITE);
186    {$ENDIF}
187 + //  writeln('Event Wait Ends');
188   end;
189  
190   procedure TEventhandlerInterface.CancelWait;
# Line 258 | Line 260 | begin
260      if FInWaitState then
261        IBError(ibxeInEventWait,[nil]);
262  
261    CreateEventBlock;
263      FEventHandler := EventHandler;
264      ReleaseIntf;
265      with Firebird30ClientAPI do
# Line 286 | Line 287 | constructor TFB30Events.Create(DBAttachm
287   begin
288    inherited Create(DBAttachment,DBAttachment,Events);
289    FAttachmentIntf := DBAttachment.AttachmentIntf;
289  FAsyncEventCallback := TEventhandlerInterface.Create(self,'Async');
290  FEventHandlerThread := TEventHandlerThread.Create(self,FAsyncEventCallback);
290    FSyncEventCallback := TEventhandlerInterface.Create(self,'Sync');
291   end;
292  
# Line 304 | Line 303 | end;
303  
304   procedure TFB30Events.AsyncWaitForEvent(EventHandler: TEventHandler);
305   begin
306 +  {Seems like we have to create a new callback object each time to avoid empty events}
307 +  if assigned(FEventHandlerThread) then
308 +    TEventHandlerThread(FEventHandlerThread).Terminate;
309 +  if assigned(FAsyncEventCallback) then TEventhandlerInterface(FAsyncEventCallback).release;
310 +  FAsyncEventCallback := TEventhandlerInterface.Create(self,'Async');
311 +  FEventHandlerThread := TEventHandlerThread.Create(self,FAsyncEventCallback);
312    InternalAsyncWaitForEvent(EventHandler,FAsyncEventCallback);
313   end;
314  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines