go icon indicating copy to clipboard operation
go copied to clipboard

兼容标准json库的“API”是线程安全的吗

Open gaort opened this issue 8 years ago • 1 comments

在高并发的场景,如果单例API的话,是否是线程(or go程)安全的嘞?

var json jsoniter.API
func init(){
  // do once
  extra.RegisterFuzzyDecoders()
  json = jsoniter.ConfigCompatibleWithStandardLibrary
}

// 高并发调用
func Unmarshal(){
  json.Unmarshal(xxx,xxx)
}

gaort avatar Jan 10 '18 03:01 gaort

it is thread safe jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal

taowen avatar Jan 10 '18 16:01 taowen