| Index: third_party/mojo/src/mojo/public/go/system/data_pipe.go
|
| diff --git a/third_party/mojo/src/mojo/public/go/system/data_pipe.go b/third_party/mojo/src/mojo/public/go/system/data_pipe.go
|
| index b79a1e0395c965452f96dcbbeccb3196c39b0e81..a433074beb7bcb4ec15d801d53ea728e1b145bf6 100644
|
| --- a/third_party/mojo/src/mojo/public/go/system/data_pipe.go
|
| +++ b/third_party/mojo/src/mojo/public/go/system/data_pipe.go
|
| @@ -86,6 +86,9 @@ type dataPipeConsumer struct {
|
| }
|
|
|
| func (h *dataPipeConsumer) ReadData(flags MojoReadDataFlags) (MojoResult, []byte) {
|
| + h.core.mu.Lock()
|
| + defer h.core.mu.Unlock()
|
| +
|
| cParams := C.MallocReadDataParams()
|
| defer C.FreeReadDataParams(cParams)
|
| *cParams.num_bytes = 0
|
| @@ -103,6 +106,9 @@ func (h *dataPipeConsumer) ReadData(flags MojoReadDataFlags) (MojoResult, []byte
|
| }
|
|
|
| func (h *dataPipeConsumer) BeginReadData(numBytes int, flags MojoReadDataFlags) (MojoResult, []byte) {
|
| + h.core.mu.Lock()
|
| + defer h.core.mu.Unlock()
|
| +
|
| cParams := C.MallocTwoPhaseActionParams()
|
| defer C.FreeTwoPhaseActionParams(cParams)
|
| *cParams.num_bytes = C.uint32_t(numBytes)
|
| @@ -112,6 +118,9 @@ func (h *dataPipeConsumer) BeginReadData(numBytes int, flags MojoReadDataFlags)
|
| }
|
|
|
| func (h *dataPipeConsumer) EndReadData(numBytesRead int) MojoResult {
|
| + h.core.mu.Lock()
|
| + defer h.core.mu.Unlock()
|
| +
|
| return MojoResult(C.MojoEndReadData(h.mojoHandle.cValue(), C.uint32_t(numBytesRead)))
|
| }
|
|
|
| @@ -120,6 +129,9 @@ type dataPipeProducer struct {
|
| }
|
|
|
| func (h *dataPipeProducer) WriteData(data []byte, flags MojoWriteDataFlags) (MojoResult, int) {
|
| + h.core.mu.Lock()
|
| + defer h.core.mu.Unlock()
|
| +
|
| cParams := C.MallocWriteDataParams(C.uint32_t(len(data)))
|
| defer C.FreeWriteDataParams(cParams)
|
| *cParams.num_bytes = C.uint32_t(len(data))
|
| @@ -130,6 +142,9 @@ func (h *dataPipeProducer) WriteData(data []byte, flags MojoWriteDataFlags) (Moj
|
| }
|
|
|
| func (h *dataPipeProducer) BeginWriteData(numBytes int, flags MojoWriteDataFlags) (MojoResult, []byte) {
|
| + h.core.mu.Lock()
|
| + defer h.core.mu.Unlock()
|
| +
|
| cParams := C.MallocTwoPhaseActionParams()
|
| defer C.FreeTwoPhaseActionParams(cParams)
|
| *cParams.num_bytes = C.uint32_t(numBytes)
|
| @@ -139,5 +154,8 @@ func (h *dataPipeProducer) BeginWriteData(numBytes int, flags MojoWriteDataFlags
|
| }
|
|
|
| func (h *dataPipeProducer) EndWriteData(numBytesWritten int) MojoResult {
|
| + h.core.mu.Lock()
|
| + defer h.core.mu.Unlock()
|
| +
|
| return MojoResult(C.MojoEndWriteData(h.mojoHandle.cValue(), C.uint32_t(numBytesWritten)))
|
| }
|
|
|