G
Guest
Hi,
I've got a method that I want to execute in a multithreaded environment
(it's a specialized spider. I want to run a whole bunch of copies at low
priority as a service). It works well running as a single application.
I was wondering if there is a "Thread-Safety Analysis Wizard"?
I'm sure I'm grossly off-base with the following, so I'm prepared to be
embarrassed. Please point me in the right direction!
I would be tempted to summarize the thread-safety rules as the following:
1. Don't make unsynchronized calls to framework (and 3rd party) methods that
are known to not be thread-safe (and how do I find out which are which, I
wonder?)
2. Don't make unsynchronized changes to static fields (I'm not sure whether
unsynchronized reads would be considered safe or not).
3. Similar to #2, watch out for access to local variables in static methods.
So, am I far off? Am I missing about 100 other cases, or some big principles
here?
Thanks for your advice.
I've got a method that I want to execute in a multithreaded environment
(it's a specialized spider. I want to run a whole bunch of copies at low
priority as a service). It works well running as a single application.
I was wondering if there is a "Thread-Safety Analysis Wizard"?
I'm sure I'm grossly off-base with the following, so I'm prepared to be
embarrassed. Please point me in the right direction!
I would be tempted to summarize the thread-safety rules as the following:
1. Don't make unsynchronized calls to framework (and 3rd party) methods that
are known to not be thread-safe (and how do I find out which are which, I
wonder?)
2. Don't make unsynchronized changes to static fields (I'm not sure whether
unsynchronized reads would be considered safe or not).
3. Similar to #2, watch out for access to local variables in static methods.
So, am I far off? Am I missing about 100 other cases, or some big principles
here?
Thanks for your advice.