| OnWakeup Event |
Applies to
TIB_Events
Declaration
TNotifyEvent = Procedure(Sender: TObject) of object;
Description
Allow customization of how events are synchronized instead of using the
default TTimer based mechanism.
This event must be kept thread-safe because it is invoked from the context of
the AST callback in a separate thread originating from the GDS32.DLL session.
//not the main thread, separate IB_Session & IB_Connection
procedure TMyDatamodule.RegisterAndWait;
begin
IB_Events.OnWakeup := Wakeup;
IB_Events.RegisterEvents;
repeat
if WaitForSingleObject(FMyWakeupEvent) = OBJECT_0 then
IB_Events.CheckEvents; //this will fire on OnEventAlert
until ... whatever ;
end;
procedure TMyDatamodule.Wakeup;
begin
SetEvent(FMyWakeupEvent);
end;
|