I have several threads that write data to the same buffer at the same time, but each one of them is writing to another range of indices in this buffer.
For example Thread1 is writing data only to indices 0-1000, Thread2 write only to indices 1001-2000, and Thread3 is writing only to indices 2001-3000.
Should I protect this buffer by using a lock method? Or is it a threads safe?
Thanks.
Editing:
It’s an int array:
int[] myArray = new int[3001];