I have used basic object.wait()
, object.notify() , object.notifyAll()
in multi-threaded programming.
I know we have the package java.util.concurrent
and it has java.util.concurrent.locks
package. Specifically in java.util.concurrent.locks
we have : Condition
, Lock
and LockSupport
(among others).
I read online about this package, and understood basics of Lock
and Condition
. However, I didn't understand LockSupport
. I did search to understand LockSupport
, however didn't find anything relevant which can help me understand what it is used for. I have seen that in LockSupport
we have methods like park()
, unPark()
etc. However, I didn't get what is the purpose of LockSupport
, it seems to be doing more or less same like Lock
?
Can anyone please help me understand why we have LockSupport
and what it does that Lock
don't do.