💾 Archived View for blitter.com › apl-books › APLX50 › APLX-manual › www.microapl.com › apl_help › c… captured on 2022-07-17 at 03:37:37.

View Raw

More Information

-=-=-=-=-=-=-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Creating APL child tasks under program control</TITLE>
<META NAME="DESCRIPTION" CONTENT="APL language help page: Creating APL child tasks under program control">
<META NAME="KEYWORDS" CONTENT="Tasks,Multi-tasking,Child tasks,apl,aplx,apl help">
<!-- %%COMMON_HEAD%% -->
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="http://www.microapl.com/styles_apl_help.css">
<!-- %%END%%-->
</HEAD>
<body>
<table>
<tr>
<td width="800" valign="top" colspan="2">
<center>Topic: <A HREF="ch.htm"><code>APLX Help</code></A> : <A HREF="ch_200.htm"><code>Multi-tasking support</code></A> : <A HREF="ch_200_030.htm"><code>Creating APL child tasks under program control</code></A> 
</center>
<center>
[ <A HREF="ch_200_020.htm">Previous</A> | <A HREF="ch_200_040.htm">Next</A> | <A HREF="ch.htm">Contents</A> | <A HREF="help_index.htm">Index</A>  | <A HREF="http://www.microapl.co.uk/apl/index.html">APL Home</A> ]</center>
<br></td>
</tr>
<tr>
<td width="120">
<a href="http://www.microapl.co.uk/apl/index.html"><img height="68" border="0" width="119" src="MicroAPL_logo.gif" alt="www.microapl.co.uk"></a>
</td>
<td align="left" valign="bottom">
<h1>Creating APL child tasks under program control</h1>
</td>
</tr>
<tr>
<td width="800" valign="top" colspan="2">
<hr>
<H2>Creating a new APL task object</H2>

<p>You can create child tasks under program control using the
'APL' System Class.  This works as follows:</p>

<Pre>            ChildTask&#8592;'&#9109;' &#9109;NEW 'APL'
</Pre>

<p>This creates a task object, but the APL task itself does not
start running until you call the <tt>Open</tt> method.  Before doing that, you can set various
properties of the new task:</p>

<H3>Specifying whether the task runs in the background</H3>

<p>By default, child tasks you create will have their own session
window.  However, if you set the <tt>background</tt>
property to 1, the task will not have a session window and all its output will
be thrown away (you must set this property before calling the <tt>Open</tt>
method).  </p>

<H3>Specifying the workspace size</H3>

<p>By default, a new child task is allocated the amount of
workspace which you have set as the default using the Preferences dialog.  The <tt>wssize</tt>
property allows you to specify a different size, as a value in bytes.  If you ask for a very small value, a minimum
value of around 100KB will be allocated. If you ask for a very big value, the operating system may allocate a
smaller value.  A value of 0 means 'use
the default'.  You must set the <tt>wssize</tt>
property before calling the <tt>Open</tt> method, but you can read it
back at any time. </p>

<H3>Specify which machine the task should run on</H3>

<p>If you are running a Client-Server implementation of APLX, you can set the <tt><A HREF="ch_030_030_0367.htm">host</A></tt> property of the APL object to specify on which machine the new APL task should run. You must do this before starting the task.</p>

<p>If you have purchased APLX64, your child APL sessions can comprise a mixture of 32-bit and 64-bit tasks.  A 32-bit task can start a 64-bit task, and vice versa.</p>

<H3>Specifying whether the task's session window is visible</H3>

<p>A task which is not a background task will have a session
window associated with it, but it may not be visible.  You can use the <tt>visible</tt> property (or the <tt>Show</tt>
and <tt>Hide</tt> methods) to control whether it is shown, just
as you would with any other window. This can be done before or after the <tt>Open</tt> method
has been called.  You can also use the <tt>where</tt>
and <tt>size</tt> properties to set or read the position and size
of the task's session window.</p>

<H2>Starting the APL task</H2>

<p>The actual APL task starts when you call the <tt>Open</tt>
method.  If the task has a session
window, it will be created at this time, and it will appear unless the <tt>visible</tt>
property is 0.  If the task has a <tt>background</tt>
property of 1, nothing will appear. The child task inherits the <code>&#9109;MOUNT</code> table of its parent, so will initially have the same mapping from library numbers to operating-system directories.</p>


<H3>Example</H3>


<p>This sequence creates a child task with its own visible
session window, and a workspace size of approximately 1MB:</p>

<pre>      ChildTask&#8592;'&#9109;' &#9109;NEW 'APL'
      ChildTask.wssize&#8592;1E6
      ChildTask.Open
</pre>

<p>You can enquire about the visibility and coordinates of the
session window as follows:</p>

<pre>      ChildTask.visible
1
      ChildTask.where
12 32 24 64 
</pre>

<p>You can change the size and position of the task's session window as you would with an ordinary window: </p>

<pre>      ChildTask.where&#8592;4 10 16 50 
</pre>

<hr>
</td>
</tr>
<tr>
<td width="800" valign="top" colspan="2">
<center>Topic: <A HREF="ch.htm"><code>APLX Help</code></A> : <A HREF="ch_200.htm"><code>Multi-tasking support</code></A> : <A HREF="ch_200_030.htm"><code>Creating APL child tasks under program control</code></A> 
</center>
<center>
[ <A HREF="ch_200_020.htm">Previous</A> | <A HREF="ch_200_040.htm">Next</A> | <A HREF="ch.htm">Contents</A> | <A HREF="help_index.htm">Index</A>  | <A HREF="http://www.microapl.co.uk/apl/index.html">APL Home</A> ]</center>
<br></td>
</tr>
</table>
<!-- %%COMMON_BODY_TAIL%% -->
<p class="copyright">Copyright &copy; 1996-2010 MicroAPL Ltd</p>
<!-- %%END%% -->
</body>
</html>