💾 Archived View for blitter.com › apl-books › APLX50 › APLX-manual › www.microapl.com › apl_help › c… captured on 2023-01-29 at 14:38:17.
⬅️ Previous capture (2022-07-17)
-=-=-=-=-=-=-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>Using 'delta' properties to share data</TITLE> <META NAME="DESCRIPTION" CONTENT="APL language help page: Using 'delta' properties to share data"> <META NAME="KEYWORDS" CONTENT="Multi-tasking,Delta properties,Sharing data,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_070.htm"><code>Using 'delta' properties to share data</code></A> </center> <center> [ <A HREF="ch_200_060.htm">Previous</A> | <A HREF="ch_200_080.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>Using 'delta' properties to share data between tasks</h1> </td> </tr> <tr> <td width="800" valign="top" colspan="2"> <hr> <p>Any property name which starts with the delta character <code>∆</code> can be used to store your own data in an object. Subject to available memory, you can have as many such properties as you like, and you can store any simple or nested array, or overlay, in each property. </p> <p>This feature works in a special way for child task objects. A delta property for the System object of a child task is the same as the delta property of the same name in the parent task's child task object. Thus the parent task can assign arbitrary data to a delta property, and the child task can access it through its own System object. If the child task writes to a delta property of its System object, the parent can see the data which has been assigned in the child task object.</p> <p>For example:</p> <pre> Task1←'⎕' ⎕NEW 'APL' Task1.wssize←200000 ⋄ Task1.background←1 Task1.∆MESSAGE←'Startup' Task1.Open Task1.Execute "'⎕' ⎕WI '∆MESSAGE' 'OK'" Task1.∆MESSAGE OK </pre> <p>This technique can be used in a number of ways. When starting a task, it can be used to pass an overlay containing all the functions and variables which the child task will need to run. When the task is running, delta properties can be used to share state information, parameters and results between the parent and the child.</p> <p>The delta property persists for as long as the child task object exists in the parent task. This means that a child task can write to a delta property, and then terminate. The data will still be available to the parent.</p> <H3>Special considerations for Client-Server versions of APLX</H3> <p>If you are running a Client-Server implementation of APLX, your APL tasks may not all be running on the same machine. However, you can still use delta properties to share data between them. The actual data is held (in memory) on the Client machine, and will be sent over the network to/from the APL task as required. All of this is transparent - you do not need to do anything special for this to work.</p> <p>The only issue to be aware of is that delta variables (like other <code>⎕WI</code> properties) are always held in 32-bit format. Data written from a 64-bit task will be converted to 32-bit form. This means that delta variables cannot be bigger than 2GB, and must not have more than 2147483647 elements. If an integer array contains numbers whose magnitude is bigger than 2*31, the array will be converted to floating-point form. Precision may be lost for integers whose magnitude is greater than 2*53. </p> <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_070.htm"><code>Using 'delta' properties to share data</code></A> </center> <center> [ <A HREF="ch_200_060.htm">Previous</A> | <A HREF="ch_200_080.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 © 1996-2010 MicroAPL Ltd</p> <!-- %%END%% --> </body> </html>