@@ -68,18 +68,20 @@ extension Task {
6868 /// to the synchronous operation.
6969 ///
7070 /// - Parameters:
71+ /// - name: Human readable name of the task.
7172 /// - priority: The priority of the task.
7273 /// Pass `nil` to use the priority from `Task.currentPriority`.
7374 /// - actorQueue: The queue on which to enqueue the task.
7475 /// - operation: The operation to perform.
7576 @discardableResult
7677 public init < ActorType: Actor > (
78+ name: String ? = nil ,
7779 priority: TaskPriority ? = nil ,
7880 on actorQueue: CancellableQueue < ActorQueue < ActorType > > ,
7981 operation: @Sendable @escaping ( isolated ActorType) async -> Success ,
8082 ) where Failure == Never {
8183 let identifier = UUID ( )
82- self . init ( priority: priority, on: actorQueue. underlyingQueue, operation: {
84+ self . init ( name : name , priority: priority, on: actorQueue. underlyingQueue, operation: {
8385 defer {
8486 actorQueue. taskIdentifierToCancelMap. writeAsync {
8587 $0 [ identifier] = nil
@@ -108,18 +110,20 @@ extension Task {
108110 /// to the synchronous operation.
109111 ///
110112 /// - Parameters:
113+ /// - name: Human readable name of the task.
111114 /// - priority: The priority of the task.
112115 /// Pass `nil` to use the priority from `Task.currentPriority`.
113116 /// - actorQueue: The queue on which to enqueue the task.
114117 /// - operation: The operation to perform.
115118 @discardableResult
116119 public init < ActorType: Actor > (
120+ name: String ? = nil ,
117121 priority: TaskPriority ? = nil ,
118122 on actorQueue: CancellableQueue < ActorQueue < ActorType > > ,
119123 operation: @escaping @Sendable ( isolated ActorType) async throws -> Success ,
120124 ) where Failure == any Error {
121125 let identifier = UUID ( )
122- self . init ( priority: priority, on: actorQueue. underlyingQueue, operation: {
126+ self . init ( name : name , priority: priority, on: actorQueue. underlyingQueue, operation: {
123127 defer {
124128 actorQueue. taskIdentifierToCancelMap. writeAsync {
125129 $0 [ identifier] = nil
@@ -148,18 +152,20 @@ extension Task {
148152 /// to the synchronous operation.
149153 ///
150154 /// - Parameters:
155+ /// - name: Human readable name of the task.
151156 /// - priority: The priority of the task.
152157 /// Pass `nil` to use the priority from `Task.currentPriority`.
153158 /// - actorQueue: The queue on which to enqueue the task.
154159 /// - operation: The operation to perform.
155160 @discardableResult
156161 public init (
162+ name: String ? = nil ,
157163 priority: TaskPriority ? = nil ,
158164 on actorQueue: CancellableQueue < ActorQueue < MainActor > > ,
159165 operation: @MainActor @escaping ( ) async -> Success ,
160166 ) where Failure == Never {
161167 let identifier = UUID ( )
162- self . init ( priority: priority, on: actorQueue. underlyingQueue, operation: {
168+ self . init ( name : name , priority: priority, on: actorQueue. underlyingQueue, operation: {
163169 defer {
164170 actorQueue. taskIdentifierToCancelMap. writeAsync {
165171 $0 [ identifier] = nil
@@ -188,18 +194,20 @@ extension Task {
188194 /// to the synchronous operation.
189195 ///
190196 /// - Parameters:
197+ /// - name: Human readable name of the task.
191198 /// - priority: The priority of the task.
192199 /// Pass `nil` to use the priority from `Task.currentPriority`.
193200 /// - actorQueue: The queue on which to enqueue the task.
194201 /// - operation: The operation to perform.
195202 @discardableResult
196203 public init (
204+ name: String ? = nil ,
197205 priority: TaskPriority ? = nil ,
198206 on actorQueue: CancellableQueue < ActorQueue < MainActor > > ,
199207 operation: @escaping @MainActor ( ) async throws -> Success ,
200208 ) where Failure == any Error {
201209 let identifier = UUID ( )
202- self . init ( priority: priority, on: actorQueue. underlyingQueue, operation: {
210+ self . init ( name : name , priority: priority, on: actorQueue. underlyingQueue, operation: {
203211 defer {
204212 actorQueue. taskIdentifierToCancelMap. writeAsync {
205213 $0 [ identifier] = nil
@@ -228,15 +236,17 @@ extension Task {
228236 /// to the synchronous operation.
229237 ///
230238 /// - Parameters:
239+ /// - name: Human readable name of the task.
231240 /// - fifoQueue: The queue on which to enqueue the task.
232241 /// - operation: The operation to perform.
233242 @discardableResult
234243 public init (
244+ name: String ? = nil ,
235245 on fifoQueue: CancellableQueue < FIFOQueue > ,
236246 @_inheritActorContext @_implicitSelfCapture operation: sending @escaping @isolated ( any) ( ) async -> Success ,
237247 ) where Failure == Never {
238248 let identifier = UUID ( )
239- self . init ( on: fifoQueue. underlyingQueue, operation: {
249+ self . init ( name : name , on: fifoQueue. underlyingQueue, operation: {
240250 defer {
241251 fifoQueue. taskIdentifierToCancelMap. writeAsync {
242252 $0 [ identifier] = nil
@@ -265,15 +275,17 @@ extension Task {
265275 /// to the synchronous operation.
266276 ///
267277 /// - Parameters:
278+ /// - name: Human readable name of the task.
268279 /// - fifoQueue: The queue on which to enqueue the task.
269280 /// - operation: The operation to perform.
270281 @discardableResult
271282 public init (
283+ name: String ? = nil ,
272284 on fifoQueue: CancellableQueue < FIFOQueue > ,
273285 @_inheritActorContext @_implicitSelfCapture operation: sending @escaping @isolated ( any) ( ) async throws -> Success ,
274286 ) where Failure == any Error {
275287 let identifier = UUID ( )
276- self . init ( on: fifoQueue. underlyingQueue, operation: {
288+ self . init ( name : name , on: fifoQueue. underlyingQueue, operation: {
277289 defer {
278290 fifoQueue. taskIdentifierToCancelMap. writeAsync {
279291 $0 [ identifier] = nil
@@ -302,20 +314,22 @@ extension Task {
302314 /// to the synchronous operation.
303315 ///
304316 /// - Parameters:
317+ /// - name: Human readable name of the task.
305318 /// - priority: The priority of the task.
306319 /// Pass `nil` to use the priority from `Task.currentPriority`.
307320 /// - fifoQueue: The queue on which to enqueue the task.
308321 /// - isolatedActor: The actor to which the operation is isolated.
309322 /// - operation: The operation to perform.
310323 @discardableResult
311324 public init < ActorType: Actor > (
325+ name: String ? = nil ,
312326 priority: TaskPriority ? = nil ,
313327 on fifoQueue: CancellableQueue < FIFOQueue > ,
314328 isolatedTo isolatedActor: ActorType ,
315329 operation: @Sendable @escaping ( isolated ActorType) async -> Success ,
316330 ) where Failure == Never {
317331 let identifier = UUID ( )
318- self . init ( priority: priority, on: fifoQueue. underlyingQueue, isolatedTo: isolatedActor, operation: {
332+ self . init ( name : name , priority: priority, on: fifoQueue. underlyingQueue, isolatedTo: isolatedActor, operation: {
319333 defer {
320334 fifoQueue. taskIdentifierToCancelMap. writeAsync {
321335 $0 [ identifier] = nil
@@ -344,20 +358,22 @@ extension Task {
344358 /// to the synchronous operation.
345359 ///
346360 /// - Parameters:
361+ /// - name: Human readable name of the task.
347362 /// - priority: The priority of the task.
348363 /// Pass `nil` to use the priority from `Task.currentPriority`.
349364 /// - fifoQueue: The queue on which to enqueue the task.
350365 /// - isolatedActor: The actor to which the operation is isolated.
351366 /// - operation: The operation to perform.
352367 @discardableResult
353368 public init < ActorType: Actor > (
369+ name: String ? = nil ,
354370 priority: TaskPriority ? = nil ,
355371 on fifoQueue: CancellableQueue < FIFOQueue > ,
356372 isolatedTo isolatedActor: ActorType ,
357373 operation: @Sendable @escaping ( isolated ActorType) async throws -> Success ,
358374 ) where Failure == any Error {
359375 let identifier = UUID ( )
360- self . init ( priority: priority, on: fifoQueue. underlyingQueue, isolatedTo: isolatedActor, operation: {
376+ self . init ( name : name , priority: priority, on: fifoQueue. underlyingQueue, isolatedTo: isolatedActor, operation: {
361377 defer {
362378 fifoQueue. taskIdentifierToCancelMap. writeAsync {
363379 $0 [ identifier] = nil
0 commit comments