чтобы получить нормальный аборт асинхронной операции,
не правя исходников, пришлось сделать такое:
var
rc: TRttiContext;
rf: TRttiField;
o: TObject;
qo: TInterfacedObject;
th: TThread;
begin
rc := TRttiContext.Create;
o := TObject(fQuery.Command.CommandIntf);
rf := rc.GetType(o.ClassInfo).GetField('FExecutor');
qo := TInterfacedObject(rf.GetValue(o).AsInterface);
rf := rc.GetType(qo.ClassInfo).GetField('FThread');
th := TThread(rf.GetValue(qo).AsObject);
rf := rc.GetType(qo.ClassInfo).GetField('FState');
rf.SetValue(qo, TValue.From(asAborted));
th.Terminate;
fQuery.Command.CommandIntf.AbortJob;
while fQuery.Command.CommandIntf.State = csAborting do
sleep(1);
end;
↧