Re: Thread-safety guarantees for basic ops
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Wed, 12 Dec 2007 17:53:45 -0000
<"Günter Prossliner" <g.prossliner/gmx/at>> wrote:
When thinking about thread-safety I've been assuming that the
following are automatically thread-safe without the need for any
explicit locking by the programmer:
- Reading a reference value
This depends on the size of the Reference. Reading Word-Sizes (Int32 on x32)
are thread-safe, but above not (Int64 on x32). Obviously for 64 bit
Platforms, reading Int64 is also threadsafe.
That depends on what you mean by "thread-safe". They're atomic, but
unless you take *some* sort of action, there'll be no guarantee you get
the latest value.
Personally, I don't count "I'll read a value which was definitely valid
at some point, but might be an hour out of date" as thread-safe :)
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
.
- Follow-Ups:
- Re: Thread-safety guarantees for basic ops
- From: Mike Capp
- Re: Thread-safety guarantees for basic ops
- References:
- Thread-safety guarantees for basic ops
- From: Mike Capp
- Re: Thread-safety guarantees for basic ops
- From: Günter Prossliner
- Thread-safety guarantees for basic ops
- Prev by Date: Re: Thread-safety guarantees for basic ops
- Next by Date: Re: Thread-safety guarantees for basic ops
- Previous by thread: Re: Thread-safety guarantees for basic ops
- Next by thread: Re: Thread-safety guarantees for basic ops
- Index(es):
Relevant Pages
|
Loading