Most processors that I know of, and all the ones that Go supports, assuming that the value is correctly alligned will write the value atomically, IE another processor will not see a partially written value.
However, I must caution you that while you say it is ok for one processor to see an old value for a time, this is not how the Go memory model works. There are no concessions for "for a time" and so on, the updated value may never be written to memory, or the old value may continue to be visible for the remainder of the program's run time.
The memory model describes what you ask for as a data race and states that your program is no longer guaranteed to run correctly. Or put more suscinctly, if you have a data race, the result of your program is undefined.
The go statement that starts a new goroutine happens before the goroutine's execution begins.
For example, in this program:
var a stringfunc f() {print(a)}func hello() {a = "hello, world"go f()}
calling hello will print "hello, world" at some point in the future (perhaps after hello has returned).
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--