Skip to content

SdlLoadAsync

Load all the data from a file path, asynchronously.

This routine returns as quickly as possible; it does not wait for the read to complete. On a successful return, this work will continue in the background. If the work begins, even failure is asynchronous: a failing return value from this function only means the work couldn't start at all.

The data is allocated with a zero byte at the end (null terminated) for convenience. This extra byte is not included in TSdlAsyncIOOutcome's BytesTransferred value.

This routine will allocate the buffer to contain the file. It must be deallocated by calling SdlFree on TSdlAsyncIOOutcome's buffer field after completion.

A TSdlAsyncIOQueue must be specified. The newly-created task will be added to it when it completes its work.

Definition

Unit: Neslib.Sdl3.IO

procedure SdlLoadAsync(const AFilename: String; const AQueue: TSdlAsyncIOQueue; 
  const AUserData: Pointer)

Parameters

AFilename: String : The path to read all available data from.

AQueue: TSdlAsyncIOQueue : A queue to add the new TSdlAsyncIO to.

AUserData: Pointer : An app-defined pointer that will be provided with the task results.

Exceptions

ESdlError: Raised on failure.

See Also