thread synchronization problem

  1. The lock used by the synchronized function is this
  2. Difference between synchronized function and synchronized code block

   The lock of the synchronization function is fixed this,

    A lock for a synchronized block of code is an arbitrary object.

    Synchronized code blocks are recommended.

 

 The four states of the thread.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325012007&siteId=291194637