Threads and arrays
Posted on 2006-07-11
Hi, any threading gurus out there?
I have an application that starts 6 different threads. Each thread will create an httpwebrequest and post off to its destination and then wait for a response.
When the response returns each thread will then insert its response into an array that has been declared globally in the application.
Each thread will know its index position number in the array and so will automatically know where its response should go.
My question is this. The part of my code which inserts into the global array could feasibly be accessed by more than one thread at a time will this cause a problem? The answer is not obvious to me. I would have thought that all should be OK as the index number is known and there is no danger of inserting responses in the wrong order.
However, thought I should check