We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 61d152f commit 323bcf9Copy full SHA for 323bcf9
tl/loader.go
@@ -9,6 +9,7 @@ import (
9
"hash/crc32"
10
"reflect"
11
"strings"
12
+ "sync"
13
)
14
15
type Serializable interface{}
@@ -126,7 +127,12 @@ func Register(typ any, tl string) uint32 {
126
127
})
128
}
129
130
+var initMx sync.Mutex
131
+
132
func RegisterWithFabric(typ any, tl string, fab func() reflect.Value) uint32 {
133
+ initMx.Lock() // we lock because init() methods in independent packages can be called in parallel
134
+ defer initMx.Unlock()
135
136
t := reflect.TypeOf(typ)
137
138
si := getStructInfoReference(t)
0 commit comments