Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1107)

Delta Between Two Patch Sets: src/pkg/encoding/gob/type.go

Issue 6637047: code review 6637047: encoding/gob: fix data race in Register (Closed)
Left Patch Set: diff -r 5a8c4552dd85 https://code.google.com/p/go/ Created 11 years, 5 months ago
Right Patch Set: diff -r 5a8c4552dd85 https://code.google.com/p/go/ Created 11 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/encoding/gob/encode.go ('k') | src/pkg/encoding/gob/type_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package gob 5 package gob
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "fmt" 9 "fmt"
10 "os" 10 "os"
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 // GobDecoder is the interface describing data that provides its own 705 // GobDecoder is the interface describing data that provides its own
706 // routine for decoding transmitted values sent by a GobEncoder. 706 // routine for decoding transmitted values sent by a GobEncoder.
707 type GobDecoder interface { 707 type GobDecoder interface {
708 // GobDecode overwrites the receiver, which must be a pointer, 708 // GobDecode overwrites the receiver, which must be a pointer,
709 // with the value represented by the byte slice, which was written 709 // with the value represented by the byte slice, which was written
710 // by GobEncode, usually for the same concrete type. 710 // by GobEncode, usually for the same concrete type.
711 GobDecode([]byte) error 711 GobDecode([]byte) error
712 } 712 }
713 713
714 var ( 714 var (
715 » registerLock sync.RWMutex 715 » registerLock sync.RWMutex
716 nameToConcreteType = make(map[string]reflect.Type) 716 nameToConcreteType = make(map[string]reflect.Type)
717 concreteTypeToName = make(map[reflect.Type]string) 717 concreteTypeToName = make(map[reflect.Type]string)
718 ) 718 )
719 719
720 // RegisterName is like Register but uses the provided name rather than the 720 // RegisterName is like Register but uses the provided name rather than the
721 // type's default. 721 // type's default.
722 func RegisterName(name string, value interface{}) { 722 func RegisterName(name string, value interface{}) {
723 if name == "" { 723 if name == "" {
724 // reserved for nil 724 // reserved for nil
725 panic("attempt to register empty name") 725 panic("attempt to register empty name")
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 Register([]uint32(nil)) 818 Register([]uint32(nil))
819 Register([]uint64(nil)) 819 Register([]uint64(nil))
820 Register([]float32(nil)) 820 Register([]float32(nil))
821 Register([]float64(nil)) 821 Register([]float64(nil))
822 Register([]complex64(nil)) 822 Register([]complex64(nil))
823 Register([]complex128(nil)) 823 Register([]complex128(nil))
824 Register([]uintptr(nil)) 824 Register([]uintptr(nil))
825 Register([]bool(nil)) 825 Register([]bool(nil))
826 Register([]string(nil)) 826 Register([]string(nil))
827 } 827 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b