Skip to content

Commit d459962

Browse files
mostynbianlancetaylor
authored andcommitted
encoding/gob: mention that Encoder and Decoder are safe for concurrent 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 <[email protected]>
1 parent 69c2c56 commit d459962

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/encoding/gob/decoder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import (
1818
const tooBig = (1 << 30) << (^uint(0) >> 62)
1919

2020
// A Decoder manages the receipt of type and data information read from the
21-
// remote side of a connection.
21+
// remote side of a connection. It is safe for concurrent use by multiple
22+
// goroutines.
2223
//
2324
// The Decoder does only basic sanity checking on decoded input sizes,
2425
// and its limits are not configurable. Take caution when decoding gob data

src/encoding/gob/encoder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import (
1212
)
1313

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

0 commit comments

Comments
 (0)