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

Comparing ibx/trunk/fbintf/client/2.5/FB25Events.pas (file contents):
Revision 45 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 216 by tony, Thu Mar 15 17:21:13 2018 UTC

# Line 60 | Line 60
60   {                                                                        }
61   {************************************************************************}
62   unit FB25Events;
63 + {$IFDEF MSWINDOWS}
64 + {$DEFINE WINDOWS}
65 + {$ENDIF}
66  
67   {$IFDEF FPC}
68 < {$mode objfpc}{$H+}
68 > {$mode delphi}
69   {$interfaces COM}
70   {$ENDIF}
71  
# Line 90 | Line 93 | type
93    public
94      constructor Create(aOwner: TFB25Events);
95      destructor Destroy; override;
96 <    procedure eventCallbackFunction(length: short; updated: PChar);
96 >    procedure eventCallbackFunction(length: short; updated: PAnsiChar);
97      procedure WaitForEvent;
98      procedure CancelWait;
99   end;
# Line 112 | Line 115 | type
115  
116      {IEvents}
117      procedure WaitForEvent;
118 <    procedure AsyncWaitForEvent(EventHandler: TEventHandler);
118 >    procedure AsyncWaitForEvent(EventHandler: TEventHandler); override;
119    end;
120  
121   implementation
# Line 150 | Line 153 | type
153   constructor TEventHandlerThread.Create(Owner: TFB25Events;
154     EventHandler: TEventhandlerInterface);
155   begin
156 <   inherited Create(true);
156 >   inherited Create(false);
157     FOwner := Owner;
158     FEventHandler := EventHandler;
159     FreeOnTerminate := true;
157   Start;
160   end;
161  
162   procedure TEventHandlerThread.Terminate;
# Line 165 | Line 167 | type
167  
168    {This procedure is used for the event call back - note the cdecl }
169  
170 < procedure IBEventCallback( ptr: pointer; length: short; updated: PChar); cdecl;
170 > procedure IBEventCallback( ptr: pointer; length: short; updated: PAnsiChar); cdecl;
171   begin
172     if (ptr = nil) or (length = 0) or (updated = nil) then
173       Exit;
# Line 195 | Line 197 | begin
197   {$ENDIF}
198    inherited Create;
199   {$IFDEF WINDOWS}
200 <  FEventHandler := CreateEvent(PSa,false,true,nil);
200 >  FEventHandler := CreateEvent(PSa,false,false,nil);
201   {$ELSE}
202    CreateGuid(GUID);
203    FEventWaiting := TEventObject.Create(PSa,false,false,GUIDToString(GUID));
# Line 214 | Line 216 | begin
216   end;
217  
218   procedure TEventhandlerInterface.eventCallbackFunction(length: short;
219 <  updated: PChar);
219 >  updated: PAnsiChar);
220   begin
221    FOwner.FCriticalSection.Enter;
222    try
223      if FOwner.FResultBuffer <> nil then
224        Move(updated[0], FOwner.FResultBuffer[0], length);
223    {$IFDEF WINDOWS}
224    SetEvent(FEventHandler);
225    {$ELSE}
226    FEventWaiting.SetEvent;
227    {$ENDIF}
225    finally
226      FOwner.FCriticalSection.Leave
227    end;
228 + //  writeln('Set Event');
229 +  {$IFDEF WINDOWS}
230 +  SetEvent(FEventHandler);
231 +  {$ELSE}
232 +  FEventWaiting.SetEvent;
233 +  {$ENDIF}
234   end;
235  
236   procedure TEventhandlerInterface.WaitForEvent;
# Line 237 | Line 240 | begin
240    {$ELSE}
241    FEventWaiting.WaitFor(INFINITE);
242    {$ENDIF}
243 + //  writeln('Event Wait Ends');
244   end;
245  
246   procedure TEventhandlerInterface.CancelWait;
# Line 298 | Line 302 | begin
302      if FInWaitState then
303        IBError(ibxeInEventWait,[nil]);
304  
301    CreateEventBlock;
305      FEventHandler := EventHandler;
306      callback := @IBEventCallback;
307      with Firebird25ClientAPI do
# Line 317 | Line 320 | begin
320  
321    FInWaitState := true;
322    try
320    CreateEventBlock;
323      with Firebird25ClientAPI do
324         Call(isc_wait_for_event(StatusVector,@FDBHandle, FEventBufferlen,FEventBuffer,FResultBuffer));
325    finally

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines