SBM AppScript Reference → Programming SBM AppScript → Extension Functions → Ext.AcquireLock( [msTimeout] )
Concurrent scripts should call this function when they need to use a shared resource that should only be accessed by one script at a time. For example, if a script needs to read a serial number from a file, increment the number, and write it back, the script should call this function before accessing the file. When the script is done with the serial number file, it should call Ext.ReleaseLock() to allow other scripts access once again. If all scripts using this file call these locking functions before and after use, then the file is never accessed by more than one script at a time. In this example, the serial numbers read and written by concurrent scripts are guaranteed valid for a single Web server configuration. Note that SBM automatically releases the lock when the script finishes execution. For details on determining if a concurrent script is available to be acquired, refer to Ext.LockIsAvailable( ).
msTimeout
This optional argument is the number of milliseconds to wait for the lock to be available. If msTimeout is omitted or negative, the thread that is processing the script is halted. While the script is waiting, its execution is frozen. This may cause performance problems for long scripts or scripts that occur repeatedly.
Returns "True" if a lock was acquired successfully. Returns "False" if the time-out period passed. If "False," the script should not execute sensitive operations because another concurrent script has the lock.
Copyright © 2007–2015 Serena Software, Inc. All rights reserved.