55 |
|
* <p>This class also supports methods that conditionally provide |
56 |
|
* conversions across the three modes. For example, method {@link |
57 |
|
* #tryConvertToWriteLock} attempts to "upgrade" a mode, returning |
58 |
< |
* valid write stamp if (1) already in writing mode (2) in reading |
58 |
> |
* a valid write stamp if (1) already in writing mode (2) in reading |
59 |
|
* mode and there are no other readers or (3) in optimistic mode and |
60 |
|
* the lock is available. The forms of these methods are designed to |
61 |
|
* help reduce some of the code bloat that otherwise occurs in |
539 |
|
} |
540 |
|
|
541 |
|
/** |
542 |
< |
* If the lock state matches the given stamp, releases |
542 |
> |
* If the lock state matches the given stamp, releases the |
543 |
|
* non-exclusive lock. |
544 |
|
* |
545 |
|
* @param stamp a stamp returned by a read-lock operation |
606 |
|
/** |
607 |
|
* If the lock state matches the given stamp then performs one of |
608 |
|
* the following actions. If the stamp represents holding a write |
609 |
< |
* lock, returns it. Or, if a read lock, if the write lock is |
610 |
< |
* available, releases the read and returns a write stamp. Or, if |
611 |
< |
* an optimistic read, returns a write stamp only if immediately |
612 |
< |
* available. This method returns zero in all other cases. |
609 |
> |
* lock, returns it. Or, if a read lock, if the write lock is |
610 |
> |
* available, releases the read lock and returns a write stamp. |
611 |
> |
* Or, if an optimistic read, returns a write stamp only if |
612 |
> |
* immediately available. This method returns zero in all other |
613 |
> |
* cases. |
614 |
|
* |
615 |
|
* @param stamp a stamp |
616 |
|
* @return a valid write stamp, or zero on failure |