Skip to main content
deleted 257 characters in body
Source Link
Charles Goodwin
  • 6.6k
  • 3
  • 36
  • 63

From the class description (at the top of the LockSupport javadoc) where it describes the permit:

This class associates with each thread that uses it, a permit (in the sense of the Semaphore class). A call to park will return immediately if the permit is available, consuming [the permit] in the process; otherwise [the call to park] may block. A call to unpark makes the permit available, if it was not already available. (Unlike with Semaphores though, permits do not accumulate. There is at most one.)

(I expanded the [text] to make it easier to read for non-English speakers.)

My interpretation of this is: the permit is a Semaphore, and if that is available then the call to park() will return immediately (and consume the Semaphore).

By "permit" it is metaphorically referring to the Semaphore class. (Parking permits... just watch out for the traffic warden!)

Hopefully somebody with a deeper understanding can elaborate on thisHopefully somebody with a deeper understanding can elaborate on this. See axtavt's answer.

As a final note, a final quote from the javadoc:

These methods are designed to be used as tools for creating higher-level synchronization utilities, and are not in themselves useful for most concurrency control applications.

From the class description (at the top of the LockSupport javadoc) where it describes the permit:

This class associates with each thread that uses it, a permit (in the sense of the Semaphore class). A call to park will return immediately if the permit is available, consuming [the permit] in the process; otherwise [the call to park] may block. A call to unpark makes the permit available, if it was not already available. (Unlike with Semaphores though, permits do not accumulate. There is at most one.)

(I expanded the [text] to make it easier to read for non-English speakers.)

My interpretation of this is: the permit is a Semaphore, and if that is available then the call to park() will return immediately (and consume the Semaphore).

By "permit" it is metaphorically referring to the Semaphore class. (Parking permits... just watch out for the traffic warden!)

Hopefully somebody with a deeper understanding can elaborate on this.

As a final note, a final quote from the javadoc:

These methods are designed to be used as tools for creating higher-level synchronization utilities, and are not in themselves useful for most concurrency control applications.

From the class description (at the top of the LockSupport javadoc) where it describes the permit:

This class associates with each thread that uses it, a permit (in the sense of the Semaphore class). A call to park will return immediately if the permit is available, consuming [the permit] in the process; otherwise [the call to park] may block. A call to unpark makes the permit available, if it was not already available. (Unlike with Semaphores though, permits do not accumulate. There is at most one.)

(I expanded the [text] to make it easier to read for non-English speakers.)

Hopefully somebody with a deeper understanding can elaborate on this. See axtavt's answer.

As a final note, a final quote from the javadoc:

These methods are designed to be used as tools for creating higher-level synchronization utilities, and are not in themselves useful for most concurrency control applications.

added 153 characters in body
Source Link
Charles Goodwin
  • 6.6k
  • 3
  • 36
  • 63

From the class description (at the top of the LockSupport javadoc) where it describes the permit:

This class associates with each thread that uses it, a permit (in the sense of the Semaphore class). A call to park will return immediately if the permit is available, consuming it[the permit] in the process; otherwise it[the call to park] may block. A call to unpark makes the permit available, if it was not already available. (Unlike with Semaphores though, permits do not accumulate. There is at most one.)

So(I expanded the [text] to make it easier to read for non-English speakers.)

My interpretation of this is: the permit is a Semaphore class, and if that semaphore is available then the call to park() will return immediately (and consume the Semaphore).

By "permit" it is metaphorically referring to semaphorethe Semaphore class. (Parking permits... just watch out for the traffic warden!)

Hopefully somebody with a deeper understanding can elaborate on this.

As a final note, a final quote from the javadoc:

These methods are designed to be used as tools for creating higher-level synchronization utilities, and are not in themselves useful for most concurrency control applications.

From the class description (at the top of the LockSupport javadoc) where it describes the permit:

This class associates with each thread that uses it, a permit (in the sense of the Semaphore class). A call to park will return immediately if the permit is available, consuming it in the process; otherwise it may block. A call to unpark makes the permit available, if it was not already available. (Unlike with Semaphores though, permits do not accumulate. There is at most one.)

So the permit is a Semaphore class, and if that semaphore is available then the call to park() will return immediately (and consume the Semaphore).

By "permit" it is metaphorically referring to semaphore. (Parking permits...)

Hopefully somebody with a deeper understanding can elaborate on this.

From the class description (at the top of the LockSupport javadoc) where it describes the permit:

This class associates with each thread that uses it, a permit (in the sense of the Semaphore class). A call to park will return immediately if the permit is available, consuming [the permit] in the process; otherwise [the call to park] may block. A call to unpark makes the permit available, if it was not already available. (Unlike with Semaphores though, permits do not accumulate. There is at most one.)

(I expanded the [text] to make it easier to read for non-English speakers.)

My interpretation of this is: the permit is a Semaphore, and if that is available then the call to park() will return immediately (and consume the Semaphore).

By "permit" it is metaphorically referring to the Semaphore class. (Parking permits... just watch out for the traffic warden!)

Hopefully somebody with a deeper understanding can elaborate on this.

As a final note, a final quote from the javadoc:

These methods are designed to be used as tools for creating higher-level synchronization utilities, and are not in themselves useful for most concurrency control applications.

Source Link
Charles Goodwin
  • 6.6k
  • 3
  • 36
  • 63

From the class description (at the top of the LockSupport javadoc) where it describes the permit:

This class associates with each thread that uses it, a permit (in the sense of the Semaphore class). A call to park will return immediately if the permit is available, consuming it in the process; otherwise it may block. A call to unpark makes the permit available, if it was not already available. (Unlike with Semaphores though, permits do not accumulate. There is at most one.)

So the permit is a Semaphore class, and if that semaphore is available then the call to park() will return immediately (and consume the Semaphore).

By "permit" it is metaphorically referring to semaphore. (Parking permits...)

Hopefully somebody with a deeper understanding can elaborate on this.