How to lock a variable used in multiple threads

前端 未结 6 2270
花落未央
花落未央 2021-02-13 02:47

I have asked a question badly over here Lock on a variable in multiple threads so for clarity I am going to ask it here and hope I can ask it correctly.

classA
          


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-13 03:03

    I've written a blog post about having multiple threads add values to a list and using lock() to prevent the writes from colliding along with why this needs to be done.

提交回复
热议问题