From 78a3d9b5d4ad172198dec331383546d0a2259efb Mon Sep 17 00:00:00 2001 From: Scott Kidder Date: Thu, 5 May 2016 13:16:00 -0700 Subject: [PATCH] Add godoc comments indicating that a mutex is needed to synchronize access across multiple goroutines --- magicmime.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/magicmime.go b/magicmime.go index c4366dc..6f19d07 100644 --- a/magicmime.go +++ b/magicmime.go @@ -124,7 +124,10 @@ const ( // NewDecoder creates a detector that uses libmagic. It initializes // the opens the magicmime database with the specified flags. Upon // success users are expected to call Close on the returned Decoder -// when it is no longer needed. +// when it is no longer needed. Access to the magicmime +// database is not synchronized; the magicmime database file-descriptor +// is referenced through a global variable. Add mutex Lock/Unlock around +// the magicmime functions if using multiple goroutines. func NewDecoder(flags Flag) (*Decoder, error) { db := C.magic_open(C.int(0)) if db == nil {