thread safe in my code to manipulate List?
Here is my code for review to see whether it is thread-safety. My question is, after remove the object instance from List buffer, I exit the lock synchronization block in method RemoveAndUseItem, is it thread safe to exit the lock synchronization and call method RemoveAndUseItem (method RemoveAndUseItem will only touch the removed instance)?
object ListLock = new object();
void AddItem(Foo f)
LastItem = Buffer[Buffer.Count - 1];
Buffer.RemoveAt(Buffer.Count - 1);
// no lock here? safe?
void SafeUseItem(Foo f)
// use f here without synchronization control
thanks in advance,