lib/sync: Fix broken build

This commit is contained in:
Audrius Butkevicius 2016-11-05 02:31:52 +00:00
parent da413b823b
commit caaab462bc
2 changed files with 7 additions and 4 deletions

View File

@ -12,8 +12,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/syncthing/syncthing/lib/logger"
"github.com/sasha-s/go-deadlock" "github.com/sasha-s/go-deadlock"
"github.com/syncthing/syncthing/lib/logger"
) )
var ( var (
@ -31,7 +31,10 @@ func init() {
l.SetDebug("sync", strings.Contains(os.Getenv("STTRACE"), "sync") || os.Getenv("STTRACE") == "all") l.SetDebug("sync", strings.Contains(os.Getenv("STTRACE"), "sync") || os.Getenv("STTRACE") == "all")
if n, err := strconv.Atoi(os.Getenv("STLOCKTHRESHOLD")); err == nil { if n, err := strconv.Atoi(os.Getenv("STLOCKTHRESHOLD")); err == nil {
deadlock.Opts.DeadlockTimeout = threshold = time.Duration(n) * time.Millisecond threshold = time.Duration(n) * time.Millisecond
}
if n, err := strconv.Atoi(os.Getenv("STDEADLOCK")); err == nil {
deadlock.Opts.DeadlockTimeout = time.Duration(n) * time.Second
} }
l.Debugf("Enabling lock logging at %v threshold", threshold) l.Debugf("Enabling lock logging at %v threshold", threshold)
} }

View File

@ -38,7 +38,7 @@ type WaitGroup interface {
func NewMutex() Mutex { func NewMutex() Mutex {
if useDeadlock { if useDeadlock {
return deadlock.Mutex{} return &deadlock.Mutex{}
} }
if debug { if debug {
mutex := &loggedMutex{} mutex := &loggedMutex{}
@ -50,7 +50,7 @@ func NewMutex() Mutex {
func NewRWMutex() RWMutex { func NewRWMutex() RWMutex {
if useDeadlock { if useDeadlock {
return deadlock.RWMutex{} return &deadlock.RWMutex{}
} }
if debug { if debug {
mutex := &loggedRWMutex{ mutex := &loggedRWMutex{