gitlab.com/evatix-go/core@v1.3.55/regexnew/CreateLockIf.go (about)

     1  package regexnew
     2  
     3  import "regexp"
     4  
     5  // CreateLockIf calls Create with mutex lock and unlock if true.
     6  func CreateLockIf(isLock bool, regularExpressionSyntax string) (*regexp.Regexp, error) {
     7  	if isLock {
     8  		regexMutex.Lock()
     9  
    10  		defer regexMutex.Unlock()
    11  	}
    12  
    13  	return Create(regularExpressionSyntax)
    14  }