Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
Package | utility | |
Module | tasking | |
Tool | servers |
The results for the specified function are obtained using the jobid that is returned when the function is started with the run function. Normally these results are cleared when result is called; however, it is possible to keep them for future access by setting the clear argument to F.
The results are provided in a record format with fields corresponding to each of the input parameters. This is to allow some input parameters to also act as output values. If the C++ function returns a value then the record will also contain a returnval field that contains the value returned by the C++ function.
jobid | Which job id we are inquiring about | ||
Allowed: | A positive integer obtained from the run function. | ||
Default: | no default | ||
clear | Delete the results from the internal buffer | ||
Allowed: | T or F | ||
Default: | T |
private.simulateRec := [_method = 'simulate', _sequence = private.id._sequence]; public.simulate := function(howmany=1, async=F) { wider private; private.simulateRec.howmany := howmany; retval := defaultservers.run(private.serverid, private.simulateRec, async); if (is_fail(retval)) return retval; if (async) { t := client("timer", 1.0); whenever t->ready do { if (!defaultservers.running(retval)) { t->terminate(); deactivate; note('Added ', howmany, ' simulated component(s) to the list.', origin='componentlist.simulate'); } } } else { note('Added ', howmany, ' simulated component(s) to the list.', origin='componentlist.simulate'); } return T; }This example illustrates how a function can be made to work both synchronously or asynchronously. In either the former case the user waits for the function to complete does not receive a glish prompt until then. In the latter case the functions returns quickly and executation proceeeds in the backgroud. In either case the note is only printed when everything has been done.