Closed alltom closed 7 years ago
I want to stream data to a view, and it seemed like the easiest way would be to write:
go func() { io.Copy(view, reader) }()
However, it looks like view.Write() isn't thread-safe.
Is the best way to accomplish this task to write my own Copy that wraps all writes in g.Execute()?
Yes, you are right. Write operations should be wrapped in g.Execute() to be thread-safe.
g.Execute()
I want to stream data to a view, and it seemed like the easiest way would be to write:
However, it looks like view.Write() isn't thread-safe.
Is the best way to accomplish this task to write my own Copy that wraps all writes in g.Execute()?