G
GeezerButler
Hello all,
I am completely new to threading and am sorry if this sounds stupid.
I am developing a class which extends from ApplicationException class.
Basically this class (MyException) captures local and instance
variables and method parameters at the time of exception. This
exception is then propogated upwards and goes on collecting the above
mentioned information of all the method/classes through which it
bubbles.
For this purpose i have a "Dictionary<string, Snapshot> methodStates"
in MyException which holds all the information.
Finally i override the ToString method of ApplicationException to
provide a nice view of all the data that my class contains.
Anyway, now since ApplicationException is not thread safe
1)Does this mean that MyException is also not thread safe even if i
lock methodStates collection whenever i access it? Is it that, if
BaseClass is not threadSafe then DerivedClass cannot be thread safe no
matter what you do.
2)Will the locking of the methodStates make sure that atleast my
dictionary is thread safe?
3)What is it that makes ApplicationException not thread safe? From my
limited knowledge, i know that a class with a mutable state is
considered not thread safe.
Basically i want to know if all the care that i am taking to lock my
dictionary is worth anything at all.
Any kind of help would be greatly appreciated.
I am completely new to threading and am sorry if this sounds stupid.
I am developing a class which extends from ApplicationException class.
Basically this class (MyException) captures local and instance
variables and method parameters at the time of exception. This
exception is then propogated upwards and goes on collecting the above
mentioned information of all the method/classes through which it
bubbles.
For this purpose i have a "Dictionary<string, Snapshot> methodStates"
in MyException which holds all the information.
Finally i override the ToString method of ApplicationException to
provide a nice view of all the data that my class contains.
Anyway, now since ApplicationException is not thread safe
1)Does this mean that MyException is also not thread safe even if i
lock methodStates collection whenever i access it? Is it that, if
BaseClass is not threadSafe then DerivedClass cannot be thread safe no
matter what you do.
2)Will the locking of the methodStates make sure that atleast my
dictionary is thread safe?
3)What is it that makes ApplicationException not thread safe? From my
limited knowledge, i know that a class with a mutable state is
considered not thread safe.
Basically i want to know if all the care that i am taking to lock my
dictionary is worth anything at all.
Any kind of help would be greatly appreciated.