$Bind: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle"><section begin="desc" />Fast, easy synchronization of system wide resource<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Fast, easy synchronization of system wide resource<section end="desc" /></span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Bind function is [[to be entered]].</p>
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The is no OO equivalent for the $Bind function.</p>


The $Bind function provides a fast and convenient way of synchronizing access to system wide resources.  
The $Bind function provides a fast and convenient way of synchronizing access to system wide resources.  
Line 10: Line 10:
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 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 only available in ''[[Sirius Mods]]'' Version 6.9 and later. If it is not specified, $Bind returns immediately, indicating that the resource was not avalable.
The second argument is the number of milliseconds to wait for the resource if it is not immediately available. This argument is only available in ''[[Sirius Mods]]'' Version 6.9 and later. If it is not specified, $Bind returns immediately, indicating that the resource was not available.
 
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %RESULT = $Bind(res_name, wait_time)
<p class="syntax"><section begin="syntax" /> %RESULT = $Bind(res_name, wait_time)
Line 19: Line 20:
<p class="code">  
<p class="code">  
  >=0 - User number that currently has resource bound
  >=0 - User number that currently has resource bound
-1 - Resource name missing
  -1 - Resource name missing
-2 - Insufficient storage to do the bind
  -2 - Insufficient storage to do the bind
  -10 - Resource already bound by current user
  -10 - Resource already bound by current user
  -20 - Resource successfully bound
  -20 - Resource successfully bound
Line 26: Line 27:
<p class="caption">$Bind return codes
<p class="caption">$Bind return codes
</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 or $UnbindW function or the binding user logs off or is restarted.  
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.  


The following program binds the resource called 'SMITHERS'.


The following program binds the resource called 'SMITHERS'.
<p class="code"> b
<p class="code"> b
  %rc = $Bind('SMITHERS')
%rc = $Bind('SMITHERS')
  end
end
</p>
</p>


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"> b
<p class="code"> b
  %rc = $Bind('BURNS', 10000)
%rc = $Bind('BURNS', 10000)
  end
end
</p>
</p>



Revision as of 16:31, 31 January 2011

<section begin="desc" />Fast, easy synchronization of system wide resource<section end="desc" />

Most Sirius $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 only available in Sirius Mods Version 6.9 and later. If it is not specified, $Bind returns immediately, indicating that the resource was not available.

Syntax

<section begin="syntax" /> %RESULT = $Bind(res_name, wait_time) <section end="syntax" />

$Bind Function

%RESULT is set to indicate the success of the function.

>=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

$Bind return codes

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.

The following program binds the resource called 'SMITHERS'.

b %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.

b %rc = $Bind('BURNS', 10000) end

Products authorizing $Bind