Possible duplicate:
Are C # Array Streams Safe?
I have been programming C # for 10 months. Now I'm learning multithreading and it seems to work great. I have a multidimensional array like
string[,] test = new string[5, 13];
I have methods for calling threads that ultimately save their outputs in different coordinates inside the array above. without any single thread writing to the same place as another thread.
So, thread1 can write to test[1,10] , but no other thread will write to test[1,10]
My question is: I read about the use of locks on objects such as my array, do I need to worry about locks at all, although my threads can access the test array at the same time, but never write to the same coordinates (memory)?
So far in my testing, I have not had any problems, but if someone is more experienced than me, I could solve the problem, then I will consider using locks.
john johnson
source share