R
Ryan Liu
Hi,
What does ArrayList.Synchronized really do for an ArrayList?
Is that equal to add lock(this) for all its public methods and properties?
Not just for Add()/Insert()/Remvoe()/Count, but also for Item (this[])?
Normally,do I need sync at all? Isn't that true without sync the program can
run faster?
For example in the master program, I have an ArrayList , each item in it is
a running thread. When the thread starts, it adds itself in, when the thread
ends, it removes itself from the master ArrayList.
Do I need synchronized version of ArrayList. Without synchronize, it can
always add itself in and remove itself, even at a race condition, right? It
will never remove wrong one right?
Thanks for clarify!
Ryan
What does ArrayList.Synchronized really do for an ArrayList?
Is that equal to add lock(this) for all its public methods and properties?
Not just for Add()/Insert()/Remvoe()/Count, but also for Item (this[])?
Normally,do I need sync at all? Isn't that true without sync the program can
run faster?
For example in the master program, I have an ArrayList , each item in it is
a running thread. When the thread starts, it adds itself in, when the thread
ends, it removes itself from the master ArrayList.
Do I need synchronized version of ArrayList. Without synchronize, it can
always add itself in and remove itself, even at a race condition, right? It
will never remove wrong one right?
Thanks for clarify!
Ryan