Thema
:
Delphi
Aufrufen einer Unterprozedur mit AsyncCalls
Einzelnen Beitrag anzeigen
Benmik
Registriert seit: 11. Apr 2009
557 Beiträge
Delphi 12 Athens
#
3
AW: Aufrufen einer Unterprozedur mit AsyncCalls
8. Mai 2016, 18:26
zusammenfalten
·
markieren
Delphi-Quellcode:
class
function
Invoke<T>(Event: TAsyncCallArgGenericMethod<T>;
const
Arg: T): IAsyncCall;
overload
;
static
;
IAsyncCall =
interface
{ Sync() waits until the asynchronous call has finished and returns the
result value of the called function if that exists. }
function
Sync: Integer;
{ Finished() returns True if the asynchronous call has finished. }
function
Finished: Boolean;
{ ReturnValue() returns the result of the asynchronous call. It raises an
exception
if called before the function has finished. }
function
ReturnValue: Integer;
{ ForceDifferentThread() tells AsyncCalls that the assigned function must
not be executed in the current thread. }
procedure
ForceDifferentThread;
{ added by Zarko Gajic to support canceling tasks waiting in the ThreadPool queue}
procedure
Cancel;
end
;
TAsyncCallArgGenericMethod<T> =
function
(Arg: T): Integer
of
object
;
Zitat
Benmik
Öffentliches Profil ansehen
Mehr Beiträge von Benmik finden