Using Actors instead of `synchronized`

前端 未结 2 1023
误落风尘
误落风尘 2021-02-05 11:16

Every time I read about using synchronized in Scala the author will usually mention that Actors should be used instead (this for example). While I understand roughl

2条回答
  •  逝去的感伤
    2021-02-05 11:38

    Actors guarantee that only a single message will be handles at time so that there will not be two threads accessing any of the instance members - ergo no need to use synchronized

提交回复
热议问题