Using atomics, which is what I stated to do, avoids the data race and is Edie sully useful with weak atomics.
> On May 26, 2019, at 1:37 PM, Sotirios Mantziaris <[email protected]> > wrote: > > I was thrown of by the previous comment. > I think i will create some "atomic" types that handle using mutexes with > setter and getter methods. > Thanks Jan > >> On Sunday, May 26, 2019 at 9:17:44 PM UTC+3, Jan Mercl wrote: >> On Sun, May 26, 2019 at 8:05 PM Sotirios Mantziaris >> <[email protected]> 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/57967151-532b-4e32-bbed-f4c0eb2a7038%40googlegroups.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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/780CAA62-06CD-4B93-A580-9BC91FDF86F9%40ix.netcom.com. For more options, visit https://groups.google.com/d/optout.
