[concurrency-interest] a question about concurrent safe access

Hanson Char hanson.char at gmail.com
Mon Sep 19 06:30:43 EDT 2005

My understanding is you will always get either A or B, except, in theory, 
there is no guarantee that the assigned reference to B will ever be visible 
to other threads other than the one doing the assignment.


On 9/19/05, Peter Veentjer - Anchor Men <p.veentjer at anchormen.nl> wrote:
> As far as I know a object reference is always set atomic. So you can`t get 
> a non existing references unlike the double or long for example (you can get 
> non existing numbers because only a part of the number is updated). 
>  ------------------------------
> *Van:* concurrency-interest-bounces at cs.oswego.edu [mailto:
> concurrency-interest-bounces at cs.oswego.edu] *Namens *Yechiel Feffer
> *Verzonden:* maandag 19 september 2005 12:14
> *Aan:* concurrency-interest at altair.cs.oswego.edu
> *Onderwerp:* [concurrency-interest] a question about concurrent safe 
> access
>  Hi all 
> say I have a pointer ( reference) to an object ( A). This reference is 
> changed to point at object B. I have threads that concurrently are using 
> that reference to get the object it points at. I dont want to synchronize 
> the usage of the reference. Is it safe to do so, i.e. if I dont use a lock 
> and I dont declare the reference volatile will I always get object A or B or 
> do I have a risk of getting "dirty" inconsistent pointer , i.e. is 
> assigning a pointer always atomic ? 
> Regrds, 
> Yechiel 
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20050919/e5a75629/attachment.htm

More information about the Concurrency-interest mailing list