Is the Go bytes.Buffer thread-safe?

前端 未结 4 2160
小蘑菇
小蘑菇 2021-02-19 05:22

In the Go programming language, is bytes.Buffer thread-safe? AFAIK, its documentation does not mention thread safety.

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-19 05:53

    Use io.Pipe() function call which provide pair of connected objects (*PipeReader, *PipeWriter) for synchronous read/write. This could be done in parallel, and it's a thread-safe.

提交回复
热议问题