Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Synchronise trace logging.

  • Loading branch information...
commit 2a45bda6fb11b73acfe11126e4fdccef89345ed5 1 parent c2abb98
@axw axw authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 gocov.go
View
5 gocov.go
@@ -26,6 +26,7 @@ import (
"io"
"log"
"os"
+ "sync"
"sync/atomic"
)
@@ -110,6 +111,8 @@ const (
// Coverage context.
type Context struct {
+ sync.Mutex
+
// ObjectList is a sorted list of coverage objects
// (packages, functions, etc.)
Objects ObjectList
@@ -145,7 +148,9 @@ func init() {
func (c *Context) logf(format string, args ...interface{}) {
if c.Tracer != nil {
+ c.Lock()
fmt.Fprintf(c.Tracer, format, args...)
+ c.Unlock()
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.