Is calling Array.Resize on an array that is being used as a buffer for SAEA threadsafe? different threads all write to their own assigned part of the array, I just want to make the array bigger without locking once the initialized size runs out as connected users increase.
byte[] buffer; //Accessed
object expand_Lock = new object();
public void AsyncAccept()
{
//Lock here so we don't resize the buffer twice at once
lock(expand_Lock)
{
if (bufferFull)
{
Array.Resize(buffer, buffer.Length + 2048 * 100); //Add space for 100 more args
//Is Array.Resize threadsafe if buffer can be read/wrote to at anytime?
AssignMoreSAEA(2048, 100); //irrelevant to question what this does
}
}
}