1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:50:06 -07:00

net/rpc: document thread safety requirements of codec types.

Fixes #6306.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/13474043
This commit is contained in:
Han-Wen Nienhuys 2013-09-12 22:03:53 +10:00 committed by Rob Pike
parent 1a819be590
commit 1e71e74262
2 changed files with 2 additions and 0 deletions

View File

@ -58,6 +58,7 @@ type Client struct {
// argument to force the body of the response to be read and then
// discarded.
type ClientCodec interface {
// WriteRequest must be safe for concurrent use by multiple goroutines.
WriteRequest(*Request, interface{}) error
ReadResponseHeader(*Response) error
ReadResponseBody(interface{}) error

View File

@ -616,6 +616,7 @@ func RegisterName(name string, rcvr interface{}) error {
type ServerCodec interface {
ReadRequestHeader(*Request) error
ReadRequestBody(interface{}) error
// WriteResponse must be safe for concurrent use by multiple goroutines.
WriteResponse(*Response, interface{}) error
Close() error