$Bind: Difference between revisions
m (1 revision) |
(Automatically generated page update) |
||
(29 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Fast, easy synchronization of system wide resource</span> | <span class="pageSubtitle">Fast, easy synchronization of system wide resource</span> | ||
<p class=" | <p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The is no OO equivalent for the $Bind function.</p> | ||
The <var>$Bind</var> function provides a fast and convenient way of synchronizing access to system wide resources. | The <var>$Bind</var> function provides a fast and convenient way of synchronizing access to system wide resources. | ||
<var>$Bind</var> accepts two arguments and returns a numeric code. | <var>$Bind</var> accepts two arguments and returns a numeric code. | ||
<ul> | |||
<li>The first argument is the name of the resource to be bound. This resource name can be any string up to 255 bytes long. Only one user can have a resource bound at a time.</li> | |||
<li> | |||
The second argument is the number of milliseconds to wait for the resource if it is not immediately available. This argument is available as of <var class="product">[[Sirius Mods]]</var> version 6.9. If it is not specified, <var>$Bind</var> returns immediately, indicating that the resource was not available.</li> | |||
</ul> | |||
==Syntax== | |||
<p class="syntax"><span class="term">%result</span> = <span class="literal">$Bind</span>(<span class="term">res_name</span>, <span class="term">wait_time</span>) | |||
</p> | |||
<p> | |||
<var class="term">%result</var> is set to indicate the success of the function.</p> | |||
== | ===$Bind return codes=== | ||
<p class="code">>=0 - User number that currently has resource bound | |||
-1 - Resource name missing | |||
-2 - Insufficient storage to do the bind | |||
-10 - Resource already bound by current user | |||
-20 - Resource successfully bound | |||
<p class="code"> | |||
</p> | </p> | ||
It is the responsibility of each programming team to establish resource naming conventions appropriate to its site. A resource remains bound until it is either explicitly unbound with the [[$Unbind and $UnbindW|$Unbind or $UnbindW]] function or the binding user logs off or is restarted. | ==Usage notes== | ||
<ul> | |||
<li>It is the responsibility of each programming team to establish resource naming conventions appropriate to its site. A resource remains bound until it is either explicitly unbound with the [[$Unbind and $UnbindW|$Unbind or $UnbindW]] function or the binding user logs off or is restarted. | |||
</ul> | |||
The following program binds the resource called 'SMITHERS' | ==Examples== | ||
The following program binds the resource called 'SMITHERS': | |||
<p class="code">begin | <p class="code">begin | ||
%rc = $Bind('SMITHERS') | |||
end | end | ||
</p> | </p> | ||
Line 39: | Line 43: | ||
The following program binds the resource called 'BURNS', waiting up to 10 seconds (10,000 milliseconds) for the resource to become available. | The following program binds the resource called 'BURNS', waiting up to 10 seconds (10,000 milliseconds) for the resource to become available. | ||
<p class="code">begin | <p class="code">begin | ||
%rc = $Bind('BURNS', 10000) | |||
end | end | ||
</p> | </p> | ||
==Products authorizing {{PAGENAMEE}}== | |||
<li>[[Sirius | <ul class="smallAndTightList"> | ||
<li>[[Sirius Functions]]</li> | |||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[[Janus Open Client]]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Janus Open Server]]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> | ||
<li> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$Bind]] | [[Category:$Functions|$Bind]] |
Latest revision as of 22:51, 20 September 2018
Fast, easy synchronization of system wide resource
Note: Many $functions have been deprecated in favor of Object Oriented methods. The is no OO equivalent for the $Bind function.
The $Bind function provides a fast and convenient way of synchronizing access to system wide resources.
$Bind accepts two arguments and returns a numeric code.
- The first argument is the name of the resource to be bound. This resource name can be any string up to 255 bytes long. Only one user can have a resource bound at a time.
- The second argument is the number of milliseconds to wait for the resource if it is not immediately available. This argument is available as of Sirius Mods version 6.9. If it is not specified, $Bind returns immediately, indicating that the resource was not available.
Syntax
%result = $Bind(res_name, wait_time)
%result is set to indicate the success of the function.
$Bind return codes
>=0 - User number that currently has resource bound -1 - Resource name missing -2 - Insufficient storage to do the bind -10 - Resource already bound by current user -20 - Resource successfully bound
Usage notes
- It is the responsibility of each programming team to establish resource naming conventions appropriate to its site. A resource remains bound until it is either explicitly unbound with the $Unbind or $UnbindW function or the binding user logs off or is restarted.
Examples
The following program binds the resource called 'SMITHERS':
begin %rc = $Bind('SMITHERS') end
The following program binds the resource called 'BURNS', waiting up to 10 seconds (10,000 milliseconds) for the resource to become available.
begin %rc = $Bind('BURNS', 10000) end