diff --git a/threadsafe.go b/threadsafe.go index 664fc61..32f0a58 100644 --- a/threadsafe.go +++ b/threadsafe.go @@ -304,9 +304,9 @@ func (t *threadSafeSet[T]) MarshalJSON() ([]byte, error) { } func (t *threadSafeSet[T]) UnmarshalJSON(p []byte) error { - t.RLock() + t.Lock() err := t.uss.UnmarshalJSON(p) - t.RUnlock() + t.Unlock() return err }