我synchronized在Java中使用了关键字和重入锁,但我不明白它们之间的区别,或者哪种情况适合于给定的情况.
synchronized
我如何决定何时使用synchronized以及何时使用可重入锁?
java thread-safety
java ×1
thread-safety ×1