Skip to content

Commit

Permalink
add lock for tag init (#14)
Browse files Browse the repository at this point in the history
Co-authored-by: phuctt <[email protected]>
  • Loading branch information
iamatsundere and phuctt authored Oct 6, 2022
1 parent 3d06bb4 commit 4056364
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/dicom/tag/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package tag
import (
"encoding/binary"
"fmt"
"sync"
)

const (
Expand Down Expand Up @@ -108,7 +109,11 @@ func FindByName(name string) (TagInfo, error) {
return TagInfo{}, fmt.Errorf("could not find tag %s", name)
}

var lock = &sync.RWMutex{}

func InitTagDict() map[DicomTag]TagInfo {
lock.Lock()
defer lock.Unlock()
if TagDict == nil {
initTag()
}
Expand Down

0 comments on commit 4056364

Please sign in to comment.