August 1999
Intermediate to advanced
1488 pages
72h 53m
English
lock.lock()
The lock() method of the Lock object locks the code in which you are working until you perform an unlock. If the code is already locked, this method will wait until it can get the lock, a timeout occurs, or an error occurs.
Listing 8.95 assumes there is a project object with a counter property, num. Because you only want to increment the counter with each new user request, it must be locked.
<SERVER> // Create a new Lock object under the project object var project.myLock = new Lock(); // Verify the lock if(!project.myLock.isValid()){ write('There has been an error constructing your lock'); }else{ // Lock the code and increment ... |
Read now
Unlock full access