| | face="Courier New" size=2>BooleanLock face=Arial size=2> can also be used to work around the problem of long size=2>synchronized blocks. Normally, when a thread is blocked waiting to acquire exclusive access to a lock (through face="Courier New" size=2>synchronized face=Arial size=2>), it will size=2>not respond to interrupts. In addition, there is no mechanism for specifying a timeout value that indicates how long a thread should wait to try to get into a face="Courier New" size=2>synchronized face=Arial size=2> block. The face="Courier New" size=2>BooleanLock face=Arial size=2> utility can be used to provide an interruptible, timeout-capable, technique for providing exclusive access to a block of code. | |
|
No comments:
Post a Comment