In the application I am writing, I need to write lots of base types, which will most likely be immutable. But I am wondering how mutable types compare in parallel applications to immutable ones.
You can use locks with mutable objects, right? How does it compare to other techniques used with immutable types in parallel applications?
You are at least away from using locks with immutable types, right?
Types
Threads
If you do have to use explicit locks, document them throughly. Especially when it comes to the order in which you lock objects. If you know that Foo objects are always locked before Bar objects and that Foo(key 100) is always locked before Foo(key = 200), you won’t get deadlocks.