J
Jeff
IDE: vs.net 2003
OS: XP pro sp2
I've got a class which contains an ArrayList object... This class will add
items to this ArrayList..... Once every minute another thread will start
and remove (based on some criteria) some items from the array... So
simultaneously as a method in one thread adds an item to the ArrayList
another thread wants to remove an item....
How should I program this?... Below is a simplified version of my code, I'm
not sure if this is the correct way of doing it...
public class Test : object
{
private ArrayList testArray;
public Test()
{
testArray = new ArrayList;
///Here I create another ArrayList:
ArrayList mySyncdAL = ArrayList.Synchronized( testArray );
...
...
}
Based on the constructor above, do you think the example below works:????
Thread A:
testArray.Add(value); //value here is just representing a
parameter, the code is simplefied
Thread B:
mySyncdAL.RemoveAt(pos)
Comments please?
Jeff
OS: XP pro sp2
I've got a class which contains an ArrayList object... This class will add
items to this ArrayList..... Once every minute another thread will start
and remove (based on some criteria) some items from the array... So
simultaneously as a method in one thread adds an item to the ArrayList
another thread wants to remove an item....
How should I program this?... Below is a simplified version of my code, I'm
not sure if this is the correct way of doing it...
public class Test : object
{
private ArrayList testArray;
public Test()
{
testArray = new ArrayList;
///Here I create another ArrayList:
ArrayList mySyncdAL = ArrayList.Synchronized( testArray );
...
...
}
Based on the constructor above, do you think the example below works:????
Thread A:
testArray.Add(value); //value here is just representing a
parameter, the code is simplefied
Thread B:
mySyncdAL.RemoveAt(pos)
Comments please?
Jeff