Re: Multi-Threading Question
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Sun, 11 Sep 2005 17:58:42 +0100
- <a@xxxxxxx> wrote:
> Local variables are always thread-safe, since they are not shared among
> threads. This is because each thread has its own stack (where the local
> variables are stored).
That's certainly true. However, if the local variable is a reference to
an object which is also being used and potentially changed on another
thread, you need to use locks, volatile variables or explicit memory
barriers to ensure safety.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: Multi-Threading Question
- From: Cool Guy
- Re: Multi-Threading Question
- References:
- Multi-Threading Question
- From: Cool Guy
- Re: Multi-Threading Question
- From: -
- Multi-Threading Question
- Prev by Date: Re: AssemblyResolve: Missleading multicastdelegate, unusable in real scenarios by design?
- Next by Date: Re: Multi-Threading Question
- Previous by thread: Re: Multi-Threading Question
- Next by thread: Re: Multi-Threading Question
- Index(es):
Relevant Pages
|