On Sun, 26 May 2019 at 19:17, Jan Mercl <0xj...@gmail.com> wrote: > On Sun, May 26, 2019 at 8:05 PM Sotirios Mantziaris > <smantzia...@gmail.com> 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.
https://golang.org/pkg/sync/atomic/#Value ? That aside, with respect to the original problem, ISTM that changing values under the noses of all those other goroutines wouldn't be that desirable even if it didn't trigger the race detector. Why not provide those goroutines with a way of registering (or obtaining) a channel on which an immutable copy of the current settings can be received? Then they can decide how to incorporate those settings into their current world view. > 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 golang-nuts+unsubscr...@googlegroups.com. > 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/CAJhgacjWLNM_aZyYfM8hc2%3DuvAX_jf1-u-OoEdGDrXFD9czZPA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.