Any practical example of LockSupport & AbstractQueuedSynchronizer use?

前端 未结 5 1225
情深已故
情深已故 2020-12-28 20:24

Guys, can anyone give a simple practical example of LockSupport & AbstractQueuedSynchronizer use? Example given in javadocs is quite strained.<

5条回答
  •  孤城傲影
    2020-12-28 20:40

    AQS is a wonderful class for building concurrency primitives – but it is complex and requires a bit of study to use it properly. I have used it for a few things like lazy initialisation and a simple fast reusable latch.

    As complex as it is, I don't think AQS is particularly vague, it has excellent javadocs describing how to use it properly.

提交回复
热议问题