AsynchronousFinished (Daemon property): Difference between revisions
m (→Examples) |
m (→Usage notes) |
||
Line 11: | Line 11: | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>It is a request cancelling error to invoke <var>AsynchronousFinished</var> against a daemon that is not processing a <var>RunAsynchronously</var> or <var>ContinueAsynchronously</var> request.</li> | <li>It is a request cancelling error to invoke <var>AsynchronousFinished</var> against a daemon that is not processing a <var>[[RunAsynchronously (Daemon subroutine)|RunAsynchronously]]</var> or <var>[[ContinueAsynchronously (Daemon subroutine)|ContinueAsynchronously]]</var> request.</li> | ||
</ul> | </ul> | ||
Revision as of 19:00, 16 May 2012
Is the asynchronous request on this Daemon finished? (Daemon class)
[Introduced in Sirius Mods 7.9]
Syntax
%boolean = daemon:AsynchronousFinished
Syntax terms
%boolean | Boolean enumeration result set to True if the asynchronous request is finished and False if it is not. |
---|---|
daemon | A previously defined Daemon object. |
Usage notes
- It is a request cancelling error to invoke AsynchronousFinished against a daemon that is not processing a RunAsynchronously or ContinueAsynchronously request.
Examples
In the following example, a master thread starts two asynchronous requests on two daemon threads and then polls them using AsynchronousFinished to determine which one is done first and process its response:
%daemon1 is object daemon %daemon2 is object daemon %doneDaemon is object daemon ... %daemon1:runAsynchronously(%commands) %daemon2:runAsynchronously(%commands) repeat forever %(system):wakeupAt(%(system):currentTimeMilliseconds + 100) if %daemon1:asynchronousFinished then %doneDaemon = %daemon1 elseIf %daemon2:asynchronousFinished then %doneDaemon = %daemon2 end if end repeat %doneDaemon:waitAsynchronous(%outputObject)