]> Cypherpunks repositories - gostls13.git/commitdiff
regexp: document that Longest method is not concurrent-safe
authorIan Lance Taylor <iant@golang.org>
Wed, 22 Mar 2017 13:05:31 +0000 (06:05 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 7 Apr 2017 21:12:11 +0000 (21:12 +0000)
Change-Id: I9ec137502353e65325087dfb60ee9bd68ffd286d
Reviewed-on: https://go-review.googlesource.com/38447
Reviewed-by: Russ Cox <rsc@golang.org>
src/regexp/regexp.go

index 4b34d53c8a9eb5e4d21abbcd902f9278628c3e4b..924b011991204ad1b4687f5a9fd9f991ae9920f1 100644 (file)
@@ -76,7 +76,8 @@ import (
 )
 
 // Regexp is the representation of a compiled regular expression.
-// A Regexp is safe for concurrent use by multiple goroutines.
+// A Regexp is safe for concurrent use by multiple goroutines,
+// except for configuration methods, such as Longest.
 type Regexp struct {
        // read-only after Compile
        regexpRO
@@ -159,6 +160,8 @@ func CompilePOSIX(expr string) (*Regexp, error) {
 // That is, when matching against text, the regexp returns a match that
 // begins as early as possible in the input (leftmost), and among those
 // it chooses a match that is as long as possible.
+// This method modifies the Regexp and may not be called concurrently
+// with any other methods.
 func (re *Regexp) Longest() {
        re.longest = true
 }