diff --git a/Sources/Pwomise/Pwomise.swift b/Sources/Pwomise/Pwomise.swift index 65c46c7..acefc30 100644 --- a/Sources/Pwomise/Pwomise.swift +++ b/Sources/Pwomise/Pwomise.swift @@ -25,6 +25,10 @@ private let dispatch_get_current_queue = dlsym(dlopen(nil, RTLD_GLOBAL), "dispat unsafeBitCast($0, to: dispatch_get_current_queue_t.self) } +public struct PromiseRuntime { + /// Enable this when debugging double-resolve errors to locate the first resolver + public static var recordResolutionStackTrace = false +} public class Promise: CustomDebugStringConvertible { internal typealias Pending = PendingPromise public typealias Completion = Result @@ -114,7 +118,9 @@ public class Promise: CustomDebugStringConvertible { return } - resolutionStackTrace = Thread.callStackSymbols + if PromiseRuntime.recordResolutionStackTrace { + resolutionStackTrace = Thread.callStackSymbols + } } }