From caaab462bcd3dfbc7a9dec6e3ed1d38dfc56ab17 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Sat, 5 Nov 2016 02:31:52 +0000 Subject: [PATCH] lib/sync: Fix broken build --- lib/sync/debug.go | 7 +++++-- lib/sync/sync.go | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/sync/debug.go b/lib/sync/debug.go index 1deefe2ca..e06182699 100644 --- a/lib/sync/debug.go +++ b/lib/sync/debug.go @@ -12,8 +12,8 @@ import ( "strings" "time" - "github.com/syncthing/syncthing/lib/logger" "github.com/sasha-s/go-deadlock" + "github.com/syncthing/syncthing/lib/logger" ) var ( @@ -31,7 +31,10 @@ func init() { l.SetDebug("sync", strings.Contains(os.Getenv("STTRACE"), "sync") || os.Getenv("STTRACE") == "all") 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) } diff --git a/lib/sync/sync.go b/lib/sync/sync.go index b421d009a..79c8ff182 100644 --- a/lib/sync/sync.go +++ b/lib/sync/sync.go @@ -38,7 +38,7 @@ type WaitGroup interface { func NewMutex() Mutex { if useDeadlock { - return deadlock.Mutex{} + return &deadlock.Mutex{} } if debug { mutex := &loggedMutex{} @@ -50,7 +50,7 @@ func NewMutex() Mutex { func NewRWMutex() RWMutex { if useDeadlock { - return deadlock.RWMutex{} + return &deadlock.RWMutex{} } if debug { mutex := &loggedRWMutex{