function ExecuteAsync(ACompletionHandler: TCompletionHandler = nil; ASynchronized: Boolean = True; AFreeThread: Boolean = True): TRESTExecutionThread;
TRESTExecutionThread* __fastcall ExecuteAsync(System::Sysutils::_di_TProc ACompletionHandler = System::Sysutils::_di_TProc(), bool ASynchronized = true, bool AFreeThread = true);
Executes a request asynchronously, i.e. runs it in its own thread.
AFreeThread parameter is set to
False, this method returns a reference to this execution thread.
Note: If the
AFreeThreadparameter is set to
True, the method returns an invalid reference.
This method defines the following parameters:
ACompletionHandler--Specifies an anonymous method to run after completing the request execution.
True, specifies that the method set in
ACompletionHandlerruns in the main thread context. When
ACompletionHandlerruns in the execution thread context.
True, the execution thread is freed after completing the request execution.
While the execution thread runs, properties of all involved TCustomRESTClient and TCustomRESTRequest instances should not be accessed from other threads (including the main thread).
The use of the ExecuteAsync method is strongly recommended on mobile platforms. iOS (and likely Android) will terminate an application if it considers the main thread to be unresponsive, i.e. if a running request takes more than a second or two to return. Sluggish behavior (caused by the main thread blocking) is considered to be unacceptable on mobile devices.