Chain lock through lock

It is mentioned that one of the advantages of Lock (java.util.concurrent.locks.Lock) over the built-in lock is that Lock facilitates the "chain lock". Lock the chain, hold the lock for A, then acquire B, after receiving B leave A, and then get C ...

I'm just wondering if you guys are faced with a situation in which it was necessary to use a chain lock?

Cheers, vic

+3
source share
1 answer

Any situation where you have a series of critical sections that are interdependent, but you want to execute them in order, would be appropriate.

, , . , - , , . , , , .

, , . , . - , . /, .

, , . , , , , , .

, , java , , . , .

+3

Source: https://habr.com/ru/post/1713175/


All Articles