$DaemonMasterNumber

From m204wiki
Revision as of 17:35, 28 January 2011 by 198.242.244.47 (talk) (Created page with "{{DISPLAYTITLE:$DaemonMasterNumber}} <span class="pageSubtitle"><section begin="desc" />Get user number of master thread<section end="desc" /></span> <p class="warning">Most Sir...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<section begin="desc" />Get user number of master thread<section end="desc" />

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $DaemonMasterNumber function is to be entered.

This function can be used to get the user number of an 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.

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.

Syntax

<section begin="syntax" /> %USERN = $DaemonMasterNumber <section end="syntax" />

$DaemonMasterNumber Function

%USERN is set to master's user number, or to -1 if not called from a daemon

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

audit 'My masters user number is ' $DaemonMasterNumber


The $DaemonMasterNumber method has a Daemon class method equivalent: MasterNumber (see the Janus SOAP Reference Manual). The $function and method can be used interchangeably, whether the daemon was created with a $COMMxx function or a Daemon object, so the decision of which to use is largely a matter of taste.

For more information about sdaemons,

This $function is new in Version 6.8 of the Sirius Mods.

  • &SFUNC

Products authorizing $DaemonMasterNumber