Skip to content

Commit

Permalink
encoding/gob: mention that Encoder and Decoder are safe for concurren…
Browse files Browse the repository at this point in the history
…t use

Fixes #29416

Change-Id: I24364bfee77aceace53f85f1046ef4d73f8feebb

Change-Id: I24364bfee77aceace53f85f1046ef4d73f8feebb
GitHub-Last-Rev: ad9f311
GitHub-Pull-Request: #29417
Reviewed-on: https://go-review.googlesource.com/c/155742
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
mostynb authored and ianlancetaylor committed Dec 28, 2018
1 parent 69c2c56 commit d459962
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/encoding/gob/decoder.go
Expand Up @@ -18,7 +18,8 @@ import (
const tooBig = (1 << 30) << (^uint(0) >> 62)

// A Decoder manages the receipt of type and data information read from the
// remote side of a connection.
// remote side of a connection. It is safe for concurrent use by multiple
// goroutines.
//
// The Decoder does only basic sanity checking on decoded input sizes,
// and its limits are not configurable. Take caution when decoding gob data
Expand Down
3 changes: 2 additions & 1 deletion src/encoding/gob/encoder.go
Expand Up @@ -12,7 +12,8 @@ import (
)

// An Encoder manages the transmission of type and data information to the
// other side of a connection.
// other side of a connection. It is safe for concurrent use by multiple
// goroutines.
type Encoder struct {
mutex sync.Mutex // each item must be sent atomically
w []io.Writer // where to send the data
Expand Down

0 comments on commit d459962

Please sign in to comment.