78 |
|
FEventsIntf: Firebird.IEvents; |
79 |
|
FAsyncEventCallback: TEventhandlerInterface; |
80 |
|
FSyncEventCallback: TEventhandlerInterface; |
81 |
+ |
FFirebird30ClientAPI: TFB30ClientAPI; |
82 |
|
procedure InternalAsyncWaitForEvent(EventHandler: TEventHandler; EventCallBack: TEventhandlerInterface); |
83 |
|
procedure ReleaseIntf; |
84 |
|
protected |
89 |
|
destructor Destroy; override; |
90 |
|
|
91 |
|
{IEvents} |
92 |
< |
procedure WaitForEvent; |
92 |
> |
procedure WaitForEvent; override; |
93 |
|
procedure AsyncWaitForEvent(EventHandler: TEventHandler); override; |
94 |
|
end; |
95 |
|
|
215 |
|
begin |
216 |
|
FEventHandler.WaitForEvent; |
217 |
|
{$IFDEF EVENTDEBUG} writeln('Event Handler Ends Wait ',Terminated); {$ENDIF} |
217 |
– |
|
218 |
|
if not Terminated then |
219 |
|
FOwner.EventSignaled; |
220 |
|
end; |
245 |
|
try |
246 |
|
if not FInWaitState then Exit; |
247 |
|
if FEventsIntf <> nil then |
248 |
< |
with Firebird30ClientAPI do |
248 |
> |
with FFirebird30ClientAPI do |
249 |
|
begin |
250 |
|
FEventsIntf.Cancel(StatusIntf); |
251 |
|
if not Force then |
274 |
|
|
275 |
|
FEventHandler := EventHandler; |
276 |
|
ReleaseIntf; |
277 |
< |
with Firebird30ClientAPI do |
277 |
> |
with FFirebird30ClientAPI do |
278 |
|
begin |
279 |
|
FEventsIntf := FAttachmentIntf.queEvents( |
280 |
|
StatusIntf,EventCallBack, |
299 |
|
begin |
300 |
|
inherited Create(DBAttachment,DBAttachment,Events); |
301 |
|
FAttachmentIntf := DBAttachment.AttachmentIntf; |
302 |
+ |
FFirebird30ClientAPI := DBAttachment.Firebird30ClientAPI; |
303 |
|
FSyncEventCallback := TEventhandlerInterface.Create(self,'Sync'); |
304 |
+ |
FAsyncEventCallback := TEventhandlerInterface.Create(self,'Async'); |
305 |
+ |
FEventHandlerThread := TEventHandlerThread.Create(self,FAsyncEventCallback); |
306 |
|
end; |
307 |
|
|
308 |
|
destructor TFB30Events.Destroy; |
318 |
|
|
319 |
|
procedure TFB30Events.AsyncWaitForEvent(EventHandler: TEventHandler); |
320 |
|
begin |
318 |
– |
{Seems like we have to create a new callback object each time to avoid empty events} |
319 |
– |
if assigned(FEventHandlerThread) then |
320 |
– |
TEventHandlerThread(FEventHandlerThread).Terminate; |
321 |
– |
if assigned(FAsyncEventCallback) then TEventhandlerInterface(FAsyncEventCallback).release; |
322 |
– |
FAsyncEventCallback := TEventhandlerInterface.Create(self,'Async'); |
323 |
– |
FEventHandlerThread := TEventHandlerThread.Create(self,FAsyncEventCallback); |
321 |
|
InternalAsyncWaitForEvent(EventHandler,FAsyncEventCallback); |
322 |
|
end; |
323 |
|
|