Skip to content

Commit 391e5b1

Browse files
johnno1962Pushkar Kulkarni
authored andcommitted
Use the workQueue.
1 parent 05a70f6 commit 391e5b1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Foundation/URLSession/URLSession.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ public let NSURLSessionTransferSizeUnknown: Int64 = -1
185185
open class URLSession : NSObject {
186186
fileprivate let _configuration: _Configuration
187187
fileprivate let multiHandle: _MultiHandle
188-
fileprivate let taskIdentifierLock = NSLock()
189188
fileprivate var nextTaskIdentifier = 1
190189
internal let workQueue: DispatchQueue
191190
/// This queue is used to make public attributes on `URLSessionTask` instances thread safe.
@@ -400,7 +399,7 @@ extension URLSession._Request {
400399

401400
fileprivate extension URLSession {
402401
func createNextTaskIdentifier() -> Int {
403-
return taskIdentifierLock.synchronized {
402+
return workQueue.sync {
404403
let i = nextTaskIdentifier
405404
nextTaskIdentifier += 1
406405
return i

0 commit comments

Comments
 (0)