Would this be safe to use? it doesnt matter if the read routine reads a partially updated array, but i need it to have all values intact. All 3 routines run in a loop
var arr [100]byte
go ReadFrom(arr)
go ReadFrom(arr)
go WriteTo(arr)
Would this be safe to use? it doesnt matter if the read routine reads a partially updated array, but i need it to have all values intact. All 3 routines run in a loop
var arr [100]byte
go ReadFrom(arr)
go ReadFrom(arr)
go WriteTo(arr)
@Pownyan, no, not safe, as mentioned by JimB in the comments. You need mutex locks to make this safe: https://golang.org/pkg/sync/#Mutex
Example: https://gobyexample.com/mutexes