I have an instance of a class that can be accessed by multiple threads.
Inside this class there is a variable [ThreadStatic] , which stores various objects.
Now I need a second instance of my class, and I want it to have a separate repository of objects.
Currently, two instances in the same thread will share the same object store. I do not want it.
The only solution I can think of is this:
You have a static IDictionary<int, TObjectStore> , where int is the stream identifier and accessed via any method or getter:
static TObjectStore ObjectStore { get {
The problem with this is how can I get rid of the TObjectStore for a specific thread when it ends? I think I correctly assume that with my current implementation, the GC will just pick it up?
thanks
source share