RunAsync()
A function that returns a Future object, which is an eventual result of an asynchronous operation (like a promise in JavaScript)
The Future Object has the following functions:
- cancel() returns Boolean
- isCancelled() returns Boolean
- isDone() returns Boolean
- error() returns Future
- get(closure, timezone) returns Future
- then(closure, timezone) returns Future
RunAsync( closure=object, timeout=number );
Returns: object
| Argument | Description | Default |
|---|---|---|
|
closure
object,
required
|
edit
Closure function that returns a Future object, which holds the result. Alias: callback, udf, function |
|
|
timeout
number,
optional
|
edit
timeout for the action |
0 |
Examples
edit future = runAsync(function(){
return 10;
}).then( function(input){
return input + 20;
});
dump(future);
result = future.get(10); // 10 is timeout(in ms)
writeOutput(result); // output is 30
See also
- Threads
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)