How and why can a Semaphore give out more permits than it was initialized with?

前端 未结 6 1294
庸人自扰
庸人自扰 2021-02-08 12:18

I am reading the book Java Concurrency in Practice. In a section about java.util.concurrent.Semaphore, the below lines are present in the book. It is a comment abou

6条回答
  •  甜味超标
    2021-02-08 13:12

    As mentioned in first post "Semaphore is not limited to the number of permits it was created with"

    Every call to .release() API will increase the permit count by one. So Semaphores doesn't have a fixed permit size

提交回复
热议问题