Skip to content

Commit cd6cb47

Browse files
committed
Moved logic out of an assertion condition as its evaluation depends on the compilation flags.
Replaced `assert` with `precondition` to allow notification of the framework user even when the framework was compiled with Release configuration.
1 parent 498d19c commit cd6cb47

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/Transactions.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ internal final class TLog {
167167

168168
static func atomically<T>(_ p : (TLog) throws -> T) throws -> T {
169169
let trans = TLog()
170-
assert(STMCurrentTransaction.tryPut(trans), "Transaction already running on current thread")
170+
let transactionEnterSucceed = STMCurrentTransaction.tryPut(trans)
171+
precondition(transactionEnterSucceed, "Transaction already running on current thread")
171172
defer {
172173
_ = STMCurrentTransaction.take()
173174
}

0 commit comments

Comments
 (0)