RE: a question about concurrent safe access

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: a question about concurrent safe access

Peter Veentjer - Anchor Men
a question about concurrent safe access
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: [hidden email] [mailto:[hidden email]] Namens Yechiel Feffer
Verzonden: maandag 19 september 2005 12:14
Aan: [hidden email]
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
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: a question about concurrent safe access

Hanson Char
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.

Hanson

On 9/19/05, Peter Veentjer - Anchor Men <[hidden email]> 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: [hidden email] [mailto:[hidden email]] Namens Yechiel Feffer
Verzonden: maandag 19 september 2005 12:14
Aan: [hidden email]
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
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest




_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest