|
|
@@ -24,17 +24,20 @@ var (
|
|
|
// }" variable, as it may be rather performance critical and does
|
|
|
// nonstandard things (from a debug logging PoV).
|
|
|
debug = strings.Contains(os.Getenv("STTRACE"), "sync") || os.Getenv("STTRACE") == "all"
|
|
|
- useDeadlock = os.Getenv("STDEADLOCKTIMEOUT") != ""
|
|
|
+ useDeadlock = false
|
|
|
)
|
|
|
|
|
|
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 {
|
|
|
+ if n, _ := strconv.Atoi(os.Getenv("STLOCKTHRESHOLD")); n > 0 {
|
|
|
threshold = time.Duration(n) * time.Millisecond
|
|
|
}
|
|
|
- if n, err := strconv.Atoi(os.Getenv("STDEADLOCKTIMEOUT")); err == nil {
|
|
|
+ l.Debugf("Enabling lock logging at %v threshold", threshold)
|
|
|
+
|
|
|
+ if n, _ := strconv.Atoi(os.Getenv("STDEADLOCKTIMEOUT")); n > 0 {
|
|
|
deadlock.Opts.DeadlockTimeout = time.Duration(n) * time.Second
|
|
|
+ l.Debugf("Enabling lock deadlocking at %v", deadlock.Opts.DeadlockTimeout)
|
|
|
+ useDeadlock = true
|
|
|
}
|
|
|
- l.Debugf("Enabling lock logging at %v threshold", threshold)
|
|
|
}
|