Skip to content

Commit 78a3d9b

Browse files
Scott Kidderskidder
authored andcommitted
Add godoc comments indicating that a mutex is needed to synchronize access across multiple goroutines
1 parent d05be4c commit 78a3d9b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

magicmime.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ const (
124124
// NewDecoder creates a detector that uses libmagic. It initializes
125125
// the opens the magicmime database with the specified flags. Upon
126126
// success users are expected to call Close on the returned Decoder
127-
// when it is no longer needed.
127+
// when it is no longer needed. Access to the magicmime
128+
// database is not synchronized; the magicmime database file-descriptor
129+
// is referenced through a global variable. Add mutex Lock/Unlock around
130+
// the magicmime functions if using multiple goroutines.
128131
func NewDecoder(flags Flag) (*Decoder, error) {
129132
db := C.magic_open(C.int(0))
130133
if db == nil {

0 commit comments

Comments
 (0)