New (Daemon constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 9: Line 9:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><i>%daem</i></th>
<tr><th>%daem</th>
<td>A previously defined Daemon object. </td></tr>
<td>A previously defined Daemon object. </td></tr>
<tr><th>CopyGlobals=<i>bool</i></th>
<tr><th>CopyGlobals=bool</th>
<td>An optional, NameRequired parameter whose value is a Boolean enumeration: valid values are <tt>True</tt> and <tt>False</tt>.  
<td>An optional, NameRequired parameter whose value is a Boolean enumeration: valid values are <tt>True</tt> and <tt>False</tt>.  
  The default is <tt>False</tt>: do not copy the existing global variable information from the master thread; use default GTBL-creation settings for the daemon.  
  The default is <tt>False</tt>: do not copy the existing global variable information from the master thread; use default GTBL-creation settings for the daemon.  
  If set to <tt>True</tt>:<ul>  <li>The GTBL server table is set to the same size on the daemon as it is on the master thread. <li>The GTBLHASH and GTBLPCT parameters on the daemon thread are set to the same value as on the master thread. <li>Only unstructured globals (globals created by $setg or $getg) and Perm Global Images in the master thread GTBL are copied to the daemon (Global Foundsets/Lists, Global Screens, and any Temp Global items are '''not''' copied). </ul>  </td></tr>
  If set to <tt>True</tt>:<ul>  <li>The GTBL server table is set to the same size on the daemon as it is on the master thread. <li>The GTBLHASH and GTBLPCT parameters on the daemon thread are set to the same value as on the master thread. <li>Only unstructured globals (globals created by $setg or $getg) and Perm Global Images in the master thread GTBL are copied to the daemon (Global Foundsets/Lists, Global Screens, and any Temp Global items are '''not''' copied). </ul>  </td></tr>
<tr><th>Transactional=<i>bool</i></th>
<tr><th>Transactional=bool</th>
<td>An optional, NameRequired parameter whose value is a Boolean enumeration: valid values are <tt>True</tt> and <tt>False</tt>. If set to <tt>True</tt>, the daemon is transactional (see [[Daemon class]]), and the master and daemon threads share a single updating transaction. If set to <tt>False</tt>, the default, the daemon is non-transactional.  
<td>An optional, NameRequired parameter whose value is a Boolean enumeration: valid values are <tt>True</tt> and <tt>False</tt>. If set to <tt>True</tt>, the daemon is transactional (see [[Daemon class]]), and the master and daemon threads share a single updating transaction. If set to <tt>False</tt>, the default, the daemon is non-transactional.  
  This parameter is new as of ''[[Sirius Mods]]'' Version 6.8.</td></tr>
  This parameter is new as of ''[[Sirius Mods]]'' Version 6.8.</td></tr>

Revision as of 16:16, 16 February 2011

Create a new Daemon (Daemon class)


New is a member of the Daemon class

This method creates a new Daemon object instance. It has two, optional, arguments.

Syntax

%daemon = [%(Daemon):]New[( [CopyGlobals= boolean], [Transactional= boolean], - [OpenAll= boolean])] Throws MaxDaemExceeded, NoFreeDaemons, DaemonLost

Syntax terms

%daem A previously defined Daemon object.
CopyGlobals=bool An optional, NameRequired parameter whose value is a Boolean enumeration: valid values are True and False.
The default is False: do not copy the existing global variable information from the master thread; use default GTBL-creation settings for the daemon. 
If set to True:
  • The GTBL server table is set to the same size on the daemon as it is on the master thread.
  • The GTBLHASH and GTBLPCT parameters on the daemon thread are set to the same value as on the master thread.
  • Only unstructured globals (globals created by $setg or $getg) and Perm Global Images in the master thread GTBL are copied to the daemon (Global Foundsets/Lists, Global Screens, and any Temp Global items are not copied).
Transactional=bool An optional, NameRequired parameter whose value is a Boolean enumeration: valid values are True and False. If set to True, the daemon is transactional (see Daemon class), and the master and daemon threads share a single updating transaction. If set to False, the default, the daemon is non-transactional. This parameter is new as of Sirius Mods Version 6.8.

Exceptions

This subroutine can throw the following exceptions:

NoFreeDaemons
If there are no daemon threads available to service the object, a NoFreeDaemons exception is thrown. This exception will only be thrown in Sirius Mods Version 7.2 and later.

Usage notes

  • The New method not only creates a Daemon object in the user tables, but it also finds a free sdaemon thread and dedicates it to the issuing user. If no sdaemon threads are available, the request is cancelled.
  • The number of daemons allowed per master thread is limited by the MAXDAEM system parameter, whose default value is 1.
  • If you specify CopyGlobals=True, and if there is insufficient server space (say, if daemons start out with very big tables, except for GTBL, and the master has a very big GTBL), the daemon fails during initialization.

See also