Failure to construct a new Lock object indicates an internal JavaScript error, such as out of memory. Method Summary lock Obtains 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.
Parameters timeout An integer indicating the number of seconds to wait for the lock.
The default value is 0, so if you do not specify a value, the method waits indefinitely. 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.