Server-side object | |
Implemented in | Netscape Server 3.0 |
Created by
The Lock
constructor:
Lock();
Parameters
None.
Failure to construct a new Lock
object indicates an internal JavaScript error, such as out of memory.
Method Summary
| Obtains the lock. |
|
Verifies that this Lock object was properly constructed.
|
| Releases the lock. |
See also
project.lock
, project.unlock
, server.lock
, server.unlock
Methods
Syntax
lock
Obtains the lock. If someone else has the lock, this method blocks until it can get the lock, the specified timeout period has elapsed, or an error occurs.
Method of |
Lock
|
Implemented in | Netscape Server 3.0 |
Syntax
lock(timeout)
Parameters
Returns
True if it succeeds in obtaining the lock within the specified timeout. False if it did not obtain the lock.
Description
You can obtain a lock for an object to ensure that different clients do not access a critical section of code simultaneously. When an application locks an object, other client requests must wait before they can lock the object.
Note that this mechanism requires voluntary compliance by asking for the lock in the first place.
See also
Lock.unlock
, Lock.isValid
, project.lock
, server.lock
isValid
Verifies that this Lock
object was properly constructed.
Method of |
Lock
|
Implemented in | Netscape Server 3.0 |
Syntax
isValid()
Parameters
None.
Returns
True, if this object was properly constructed; otherwise, false.
Description
It is very rare that your Lock
object would not be properly constructed. This happens only if the runtime engine runs out of system resources while creating the object.
Examples
This code creates a Lock
object and verifies that nothing went wrong creating it:
// construct a new Lock and save in project
project.ordersLock = new Lock();
if (! project.ordersLock.isValid()) {
// Unable to create a Lock. Redirect to error page
...
} See also
Lock.lock
, Lock.unlock
Method of |
Lock
|
Implemented in | Netscape Server 3.0 |
Syntax
unlock()
Parameters
None.
Returns
False if it fails; otherwise, true. Failure indicates an internal JavaScript error or that you attempted to unlock a lock that you don't own.
Description
If you unlock a lock that is unlocked, the resulting behavior is undefined.
See also
Lock.lock
, Lock.isValid
, project.unlock
, server.unlock
Last Updated: 10/31/97 12:33:29