Thanks for the clarification Robert.

On Sunday, May 26, 2019 at 9:50:56 PM UTC+3, Robert Engels wrote:
>
> I was referring to updating a reference to a string, which can be updated 
> atomically. 
>
> This is an advantage that Java offers over Go for concurrent programming. 
> Since everything is reference you don’t face this distinction. Which is why 
> most Go uses channels, which are implemented with locks. 
>
> > On May 26, 2019, at 1:16 PM, Jan Mercl <0xj...@gmail.com <javascript:>> 
> wrote: 
> > 
> > On Sun, May 26, 2019 at 8:05 PM Sotirios Mantziaris 
> > <smant...@gmail.com <javascript:>> wrote: 
> > 
> >> From what i understand you propose to create a new object and switch 
> out the old one with the new one using the atomic package of go. 
> > 
> > That cannot work. String is a multi word value. There's nothing in the 
> > atomic package that can update a multi word value. However, a pointer 
> > to anything _can_ be updated atomically. 
> > 
> > You cannot "safely" cheat on the data race. As said before, you must 
> > synchronize (the readers vs writers). There's no other option. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "golang-nuts" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to golan...@googlegroups.com <javascript:>. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/CAA40n-XTGeeN%3D%3D7R7QMc22KMs_iTWgO4Z%3DWfqoKaFkftenY-7Q%40mail.gmail.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/cde4e8b0-a104-4429-9f30-94cda14332b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to