diff options
| author | Aliaksandr Valialkin <valyala@gmail.com> | 2016-04-15 00:33:28 +0300 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2016-05-06 16:43:51 +0000 |
| commit | c81a3532fea42df33dea54497dfaa96873c2d976 (patch) | |
| tree | 46da51ae16ddd945e341446aa6fdc7140068bdbc /src/sync/pool.go | |
| parent | 258a4c3daf992958f5d7dc5bccf2c5b41e236959 (diff) | |
| download | go-c81a3532fea42df33dea54497dfaa96873c2d976.tar.xz | |
cmd/vet: check sync.* types' copying
Embed noLock struct into the following types, so `go vet -copylocks` catches
their copying additionally to types containing sync.Mutex:
- sync.Cond
- sync.WaitGroup
- sync.Pool
- atomic.Value
Fixes #14582
Change-Id: Icb543ef5ad10524ad239a15eec8a9b334b0e0660
Reviewed-on: https://go-review.googlesource.com/22015
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/sync/pool.go')
| -rw-r--r-- | src/sync/pool.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sync/pool.go b/src/sync/pool.go index 2acf505f3c..bf29d88c5c 100644 --- a/src/sync/pool.go +++ b/src/sync/pool.go @@ -40,7 +40,10 @@ import ( // that scenario. It is more efficient to have such objects implement their own // free list. // +// A Pool must not be copied after first use. type Pool struct { + noCopy noCopy + local unsafe.Pointer // local fixed-size per-P pool, actual type is [P]poolLocal localSize uintptr // size of the local array |
