AsynchronousFinished (Daemon property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Automatically generated page update)
 
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:Daemon:AsynchronousFinished subtitle}}
{{Template:Daemon:AsynchronousFinished subtitle}}
This page is [[under construction]].
==Syntax==
==Syntax==
{{Template:Daemon:AsynchronousFinished syntax}}
{{Template:Daemon:AsynchronousFinished syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%boolean</th><td><var>Boolean</var> value</td></tr>
<tr><th>%boolean</th>
<td><var>A [[Boolean enumeration|Boolean]]</var> enumeration result: <code>True</code> if the asynchronous request is finished, and <code>False</code> if it is not.</td></tr>
<tr><th>daemon</th>
<tr><th>daemon</th>
<td>Daemon object</td></tr>
<td>A <var>[[Daemon class|Daemon]]</var> object.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<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>
==Examples==
==Examples==
In the following example, a master thread starts two asynchronous requests on two daemon threads and then polls them using <var>AsynchronousFinished</var> to determine which one is done first and then process its response:
<p class="code">%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)
</p>
==See also==
==See also==
{{Template:Daemon:AsynchronousFinished footer}}
{{Template:Daemon:AsynchronousFinished footer}}

Latest revision as of 02:11, 8 July 2012

Is the asynchronous request on this Daemon finished? (Daemon class)

[Introduced in Sirius Mods 7.9]

Syntax

%boolean = daemon:AsynchronousFinished

Syntax terms

%boolean A Boolean enumeration result: True if the asynchronous request is finished, and False if it is not.
daemon A Daemon object.

Usage notes

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 then 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)

See also