Skip to content

Commit 1a7734e

Browse files
Make Counter.increment() static method mode clear
1 parent e439b04 commit 1a7734e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Sources/web3swift/Web3/Web3+JSONRPC.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ public struct Counter {
1414
public static var counter: UInt = 1
1515
public static var lockQueue = DispatchQueue(label: "counterQueue")
1616
public static func increment() -> UInt {
17-
var c: UInt = 0
18-
lockQueue.sync {
19-
c = Counter.counter
20-
Counter.counter = Counter.counter + 1
17+
defer {
18+
lockQueue.sync {
19+
Counter.counter += 1
20+
}
2121
}
22-
return c
22+
return counter
2323
}
2424
}
2525

0 commit comments

Comments
 (0)