Asynchronous Statements

From RemObjects Software

Jump to: navigation, search

New page awaiting review

Please do not rely on the content. After review, the page will be indexed and may have its name changed.

If you have suggestions for this page, please send them to us: email.

This is a Oxygene Language Feature topic
Feel free to add your notes to this topic below.



Asynchronous statements are a new feature on Oxygene 3.0 that makes it possible to run 1 or more statements asynchronously from the method in which it is defined. Async statements are added to the .NET thread pool or in case the PFX framework is referenced it is ran through the PFX framework as a task. To define async statements, the async keyword can be added before the statement, for example:

async for i := 0 to 10 do begin

...
end;

or

async begin

...
end;

All locals/params used are copied at the point of the async statement, so changes are not passed back (the procedure could be done already).

When you need to wait until an asynchronous statement is done you can assign the result of the async statement into a variable. This will return a System.Action that will force the statement to run, or wait until it's finished:

var x := async for i:= 0 to 100 do begin

...
end;

...

x;


Product: RemObjects Oxygene (formerly known as Chrome)
Current version: 3.0 Previous Versions: 'Joyride' (2.0), 'Floorshow' (1.5), 'Adrenochrome' (1.0)

GlossaryKeywordsLanguage FeaturesPlatform FeaturesSamplesArticlesHow ToIssues

Personal tools