Continue (Daemon function): Difference between revisions
mNo edit summary |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:Daemon:Continue subtitle}} | {{Template:Daemon:Continue subtitle}} | ||
This method | This [[Notation conventions for methods#Callable functions|callable]] method tells a daemon that did a <var>[[ReturnToMaster (Daemon subroutine)|ReturnToMaster]]</var> <var>Daemon</var> class call to continue processing at the point of the call. | ||
==Syntax== | ==Syntax== | ||
Line 10: | Line 10: | ||
<tr><th>%stringlist</th><td>If specified, a <var>[[Stringlist class|Stringlist]]</var> object to contain the terminal output from the continued request on the daemon thread.</td></tr> | <tr><th>%stringlist</th><td>If specified, a <var>[[Stringlist class|Stringlist]]</var> object to contain the terminal output from the continued request on the daemon thread.</td></tr> | ||
<tr><th>daemon</th> | <tr><th>daemon</th> | ||
<td>A <var>[[Daemon class|Daemon]]</var> object</td></tr> | <td>A <var>[[Daemon class|Daemon]]</var> object.</td></tr> | ||
<tr><th><var>Input</var></th> | <tr><th><var>Input</var></th> | ||
<td>The input object passed to the daemon thread. This optional, [[Methods#Named parameters|name required]] argument is passed by deep copy and not by reference, so <var | <td>The input object passed to the daemon thread. This optional, [[Methods#Named parameters|name required]] argument is passed by deep copy and not by reference, so the <var>Input</var> value must be deep copyable, as described in: [[Copying objects|"Copying objects"]]. The passed object can be retrieved by the daemon thread using <var>[[GetInputObject (Daemon subroutine)|GetInputObject]]</var>.</td></tr> | ||
<tr><th><var>Output</var></th> | <tr><th><var>Output</var></th> | ||
<td>The output object returned from the daemon thread. This optional, | <td>The output object returned from the daemon thread. This optional, name required argument is passed by deep copy and not by reference, so the <var>Output</var> object must be deep copyable. The object set to <var>Output</var> is the object passed by the daemon thread using <var>[[ReturnObject (Daemon subroutine)|ReturnObject]]</var>. | ||
<p>Because <var | <p>Because <var>Output</var> is an output variable, it cannot itself be contained inside an object: that is, it must be a local or a common %variable.</p></td></tr> | ||
<tr><th><var>Info</var></th> | <tr><th><var>Info</var></th> | ||
<td>An optional, | <td>An optional, name required parameter that indicates a second output object returned from the daemon thread. This optional argument is passed by deep copy and not by reference, so the <var>Info</var> object must be deep copyable. The object set to <var>Info</var> is the object passed by the daemon thread using <var>[[ReturnInfoObject (Daemon subroutine)|ReturnInfoObject]]</var>. | ||
<p>Because <var | <p>Because <var>Info</var> is an output variable, it cannot itself be contained inside an object: that is, it must be a local or a common %variable. </p></td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>Issuing a <var>Continue</var> against a daemon not in a ReturnToMaster wait results in | <li>Issuing a <var>Continue</var> against a daemon not in a <var>ReturnToMaster</var> wait results in an <var>[[IncorrectDaemonState class|IncorrectDaemonState]]</var> exception.</li> | ||
<li>[[ContinueAsynchronously (Daemon subroutine)|ContinueAsynchronously]] and [[ContinueIndependently (Daemon subroutine)|ContinueIndependently]] methods are available to tell a daemon to continue from the ReturnToMaster but to not wait for the daemon response.</li> | <li>The <var>[[ContinueAsynchronously (Daemon subroutine)|ContinueAsynchronously]]</var> and <var>[[ContinueIndependently (Daemon subroutine)|ContinueIndependently]]</var> methods are available to tell a daemon to continue from the <var>ReturnToMaster</var> but to not wait for the daemon response.</li> | ||
</ul> | </ul> | ||
==Examples== | ==Examples== | ||
The following request exchanges and updates copies of the same XmlDoc 10 times between a master and daemon thread: | The following request exchanges and updates copies of the same <var>XmlDoc</var> 10 times between a master and daemon thread: | ||
<p class="code">begin | <p class="code">begin | ||
%dmn is object daemon | %dmn is object daemon | ||
Line 36: | Line 35: | ||
%outDoc is object xmlDoc | %outDoc is object xmlDoc | ||
%prog is object stringlist | %prog is object stringlist | ||
%dmn = new | %dmn = new | ||
%dmn:run('*LOWER') | %dmn:run('*LOWER') | ||
text to %prog = new raw | text to %prog = new raw | ||
Line 60: | Line 57: | ||
%dmn:run(%prog):print | %dmn:run(%prog):print | ||
%inDoc = new | %inDoc = new |
Latest revision as of 23:09, 17 May 2012
Continue processing in daemon (Daemon class)
[Introduced in Sirius Mods 8.1]
This callable method tells a daemon that did a ReturnToMaster Daemon class call to continue processing at the point of the call.
Syntax
[%sl =] daemon:Continue[( [Input= object], [Output= object], [Info= object])] Throws DaemonLost, IncorrectDaemonState
Syntax terms
%stringlist | If specified, a Stringlist object to contain the terminal output from the continued request on the daemon thread. |
---|---|
daemon | A Daemon object. |
Input | The input object passed to the daemon thread. This optional, name required argument is passed by deep copy and not by reference, so the Input value must be deep copyable, as described in: "Copying objects". The passed object can be retrieved by the daemon thread using GetInputObject. |
Output | The output object returned from the daemon thread. This optional, name required argument is passed by deep copy and not by reference, so the Output object must be deep copyable. The object set to Output is the object passed by the daemon thread using ReturnObject.
Because Output is an output variable, it cannot itself be contained inside an object: that is, it must be a local or a common %variable. |
Info | An optional, name required parameter that indicates a second output object returned from the daemon thread. This optional argument is passed by deep copy and not by reference, so the Info object must be deep copyable. The object set to Info is the object passed by the daemon thread using ReturnInfoObject.
Because Info is an output variable, it cannot itself be contained inside an object: that is, it must be a local or a common %variable. |
Usage notes
- Issuing a Continue against a daemon not in a ReturnToMaster wait results in an IncorrectDaemonState exception.
- The ContinueAsynchronously and ContinueIndependently methods are available to tell a daemon to continue from the ReturnToMaster but to not wait for the daemon response.
Examples
The following request exchanges and updates copies of the same XmlDoc 10 times between a master and daemon thread:
begin %dmn is object daemon %indoc is object xmlDoc %outDoc is object xmlDoc %prog is object stringlist %dmn = new %dmn:run('*LOWER') text to %prog = new raw b %doc is object xmlDoc %i is float for %i from 1 to 10 printText **** Here I am {%i} %(daemon):returnObject(%doc) %(daemon):returnToMaster %(daemon):getInputObject(%doc) %doc:print %doc:selectSingleNode('*'):addElement('number', %i) end for %doc:selectSingleNode('*'):addAttribute('done', 'yes') %(daemon):returnObject(%doc) end end text %dmn:run(%prog):print %inDoc = new %indoc:addElement('foo') repeat forever %dmn:continue(input=%indoc, output=%outDoc):print %outDoc:print if %outDoc:valueDefault('/foo/@done') eq 'yes' then loop end; end if %inDoc = %outDoc end repeat end