[go-nuts] Re: Thread safety programatic definition for Go

2017-01-20 Thread adonovan via golang-nuts
On Sunday, 1 January 2017 06:43:32 UTC-5, josvazg wrote: > I am trying to come up with a detailed definition of what a thread safe Go > program is (and is not). One that a (go) tool could check by analyzing the > code for me. > You've set yourself an impossible task. A function is thread-safe

Re: [go-nuts] Re: Thread safety programatic definition for Go

2017-01-01 Thread josvazg
Thanks, That was very useful, I did slip on the globals definition. And I also kind of overlook init()s running before main(). Although I have to check what happens exactly when a go statement is kicked off on an init() body, will it wait for main()? Also yes, the bottom line for race free code

Re: [go-nuts] Re: Thread safety programatic definition for Go

2017-01-01 Thread Michael Jones
Josvazg, Your notion of "globals safe" should allow init() functions as safe writers. They are always invoked serially. On Sun, Jan 1, 2017 at 7:29 AM wrote: > > On Sunday, January 1, 2017 at 4:43:32 AM UTC-7, josvazg wrote: > > I am trying to come up with a detailed definition of what a thread

[go-nuts] Re: Thread safety programatic definition for Go

2017-01-01 Thread chrisstocktonaz
On Sunday, January 1, 2017 at 4:43:32 AM UTC-7, josvazg wrote: > > I am trying to come up with a detailed definition of what a thread safe Go > program is (and is not). One that a (go) tool could check by analyzing the > code for me. > > Otherwise: > >- > >A program is globals sa