$DaemonMasterNumber: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
 
(5 intermediate revisions by 3 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">Get user number of master thread</span>
<span class="pageSubtitle">Get user number of master thread</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $DaemonMasterNumber function is [[MasterNumber (Daemon property)]]. The OO APIs emphasize the use of the [[List of Daemon methods|Daemon methods]]; users are strongly urged to use the new Daemon API instead of the old $functions.</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $DaemonMasterNumber function is <var>[[MasterNumber (Daemon property)|MasterNumber]]</var>. The OO APIs emphasize the use of the [[List of Daemon methods|Daemon methods]]; users are strongly urged to use the new Daemon API instead of the old $functions.</p>


This function can be used to get the user number of an sdaemon's master thread.  
This function can be used to get the user number of an [[Sdaemons|sdaemon]]'s master thread.  


The $DaemonMasterNumber function accepts no arguments. The $DaemonMasterNumber function returns the same value as the $DaemonParentNumber function [[$DaemonParentNumber]], except in the case where the parent thread, itself, has a parent. In such a case, the $DaemonMasterNumber method follows the chain of parents to the highest level, that is, to the parent that does not, itself, have a parent.  
The <var>$DaemonMasterNumber</var> function accepts no arguments.  


If the thread issuing $DaemonMasterNumber is not an sdaemon, or is an sdaemon but is not performing work for another thread via a Daemon object or a <var>$COMMxx</var> function, or is an asynchronous daemon, the $DaemonMasterNumber function returns a -1 value.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" />%USERN = $DaemonMasterNumber
<p class="syntax">%usern = $DaemonMasterNumber
<section end="syntax" /></p>
<p>
</p>
</p>
<p>%USERN is set to master's user number, or to -1 if not called from a daemon</p>


===Syntax terms===
<table class="syntaxTable">
<tr><th>%usern</th>
<td>A numeric variable that is set to the daemon master's user number, or it is set to -1 if not called from a daemon.</td></tr>
</table>
==Usage notes==
<ul>
<li>The <var>$DaemonMasterNumber function</var> returns the same value as the <var>[[$DaemonParentNumber]]</var> function, except in the case where the parent thread, itself, has a parent. In such a case, the <var>$DaemonMasterNumber</var> method follows the chain of parents to the highest level, that is, to the parent that does not, itself, have a parent.
<li>If the thread issuing <var>$DaemonMasterNumber</var> is not an sdaemon, or is an sdaemon but is not performing work for another thread via a <var>[[Daemon class|Daemon]]</var> object or a <var>$COMMxx</var> function, or is an asynchronous daemon, the <var>$DaemonMasterNumber</var> function returns a -1 value.
<li>The $DaemonMasterNumber method has a <var>Daemon</var> class method equivalent: <var>MasterNumber</var>. The $function and method can be used interchangeably, whether the daemon was created with a <var>$COMMxx</var> function or a <var>Daemon</var> object.
<li>This $function is new in Version 6.8 of the <var class="product">[[Sirius Mods]]</var>.
</ul>
==Example==
The following code audits a thread's master user number:
The following code audits a thread's master user number:
<p class="code"> audit 'My master''s user number is ' $DaemonMasterNumber
<p class="code">audit 'My master&apos;&apos;s user number is ' $DaemonMasterNumber</p>
</p>
 
The $DaemonMasterNumber method has a Daemon class method equivalent: MasterNumber. The $function and method can be used interchangeably, whether the daemon was created with a <var>$COMMxx</var> function or a Daemon object.


This $function is new in Version 6.8 of the <var class="product">[[Sirius Mods]]</var>.<p>


[[Category:$Functions|$DaemonMasterNumber]]
[[Category:$Functions|$DaemonMasterNumber]]

Latest revision as of 22:51, 20 September 2018

Get user number of master thread

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $DaemonMasterNumber function is MasterNumber. The OO APIs emphasize the use of the Daemon methods; users are strongly urged to use the new Daemon API instead of the old $functions.

This function can be used to get the user number of an sdaemon's master thread.

The $DaemonMasterNumber function accepts no arguments.

Syntax

%usern = $DaemonMasterNumber

Syntax terms

%usern A numeric variable that is set to the daemon master's user number, or it is set to -1 if not called from a daemon.

Usage notes

  • The $DaemonMasterNumber function returns the same value as the $DaemonParentNumber function, except in the case where the parent thread, itself, has a parent. In such a case, the $DaemonMasterNumber method follows the chain of parents to the highest level, that is, to the parent that does not, itself, have a parent.
  • If the thread issuing $DaemonMasterNumber is not an sdaemon, or is an sdaemon but is not performing work for another thread via a Daemon object or a $COMMxx function, or is an asynchronous daemon, the $DaemonMasterNumber function returns a -1 value.
  • The $DaemonMasterNumber method has a Daemon class method equivalent: MasterNumber. The $function and method can be used interchangeably, whether the daemon was created with a $COMMxx function or a Daemon object.
  • This $function is new in Version 6.8 of the Sirius Mods.

Example

The following code audits a thread's master user number:

audit 'My master''s user number is ' $DaemonMasterNumber