Pass reference of object to a new Thread

后端 未结 4 383
天命终不由人
天命终不由人 2020-12-20 01:29

I have an object that contains a very large 3D-array of doubles and I need to start a new thread that need the data of this array, so I will either need to start a new threa

4条回答
  •  猫巷女王i
    2020-12-20 01:57

    Assuming that your MyClass is a class, then the reference of the object is only passed to the new thread, since it is a reference type(read more on reference types on MSDN), i would also suggest that you use a lock in order avoid deadlock issues you can do that simply by using the lock keyword

提交回复
热议问题