@@ -30,8 +30,7 @@ import CDispatch
30
30
// returned from API methods with DISPATCH_RETURNS_RETAINED
31
31
//////////
32
32
33
- public typealias dispatch_object_t = DispatchObject
34
- public class DispatchObject {
33
+ public class dispatch_object_t {
35
34
let cobj : OpaquePointer ;
36
35
37
36
deinit {
@@ -43,33 +42,22 @@ public class DispatchObject {
43
42
}
44
43
}
45
44
46
- public typealias dispatch_data_t = DispatchData
47
- public class DispatchData : DispatchObject {
45
+ public class dispatch_data_t : dispatch_object_t {
48
46
}
49
47
50
-
51
- public typealias dispatch_group_t = DispatchGroup
52
- public class DispatchGroup : DispatchObject {
48
+ public class dispatch_group_t : dispatch_object_t {
53
49
}
54
50
55
-
56
- public typealias dispatch_io_t = DispatchIO
57
- public class DispatchIO : DispatchObject {
51
+ public class dispatch_io_t : dispatch_object_t {
58
52
}
59
53
60
-
61
- public typealias dispatch_queue_t = DispatchQueue
62
- public class DispatchQueue : DispatchObject {
54
+ public class dispatch_queue_t : dispatch_object_t {
63
55
}
64
56
65
-
66
- public typealias dispatch_semaphore_t = DispatchSemaphore
67
- public class DispatchSemaphore : DispatchObject {
57
+ public class dispatch_semaphore_t : dispatch_object_t {
68
58
}
69
59
70
-
71
- public typealias dispatch_source_t = DispatchSource
72
- public class DispatchSource : DispatchObject {
60
+ public class dispatch_source_t : dispatch_object_t {
73
61
}
74
62
75
63
//////////
@@ -175,7 +163,7 @@ public var DISPATCH_QUEUE_PRIORITY_BACKGROUND: dispatch_queue_priority_t {
175
163
}
176
164
177
165
public func dispatch_get_global_queue( identifier: Int , _ flags: UInt ) -> dispatch_queue_t {
178
- return DispatchQueue ( CDispatch . dispatch_get_global_queue ( identifier, flags) )
166
+ return dispatch_queue_t ( CDispatch . dispatch_get_global_queue ( identifier, flags) )
179
167
}
180
168
181
169
// skip dispatch_queue_attr_make_with_qos_class; no QoS on Linux
@@ -191,7 +179,7 @@ public var DISPATCH_QUEUE_CONCURRENT: dispatch_queue_attr_t {
191
179
192
180
public func dispatch_queue_create( label: UnsafePointer < Int8 > ,
193
181
_ attr: dispatch_queue_attr_t ) -> dispatch_queue_t {
194
- return DispatchQueue ( CDispatch . dispatch_queue_create ( label, attr) )
182
+ return dispatch_queue_t ( CDispatch . dispatch_queue_create ( label, attr) )
195
183
}
196
184
197
185
public var DISPATCH_CURRENT_QUEUE_LABEL : dispatch_queue_t ? {
@@ -362,7 +350,7 @@ public func dispatch_source_create(type:dispatch_source_type_t,
362
350
_ mask: UInt ,
363
351
_ queue: dispatch_queue_t ? ) -> dispatch_source_t {
364
352
let cqueue = queue != nil ? queue!. cobj : nil
365
- return DispatchSource ( CDispatch . dispatch_source_create ( type, handle, mask, cqueue) )
353
+ return dispatch_source_t ( CDispatch . dispatch_source_create ( type, handle, mask, cqueue) )
366
354
}
367
355
368
356
public func dispatch_source_set_event_handler( source: dispatch_source_t ,
@@ -416,7 +404,7 @@ public func dispatch_source_set_registration_handler(source:dispatch_source_t,
416
404
//////////
417
405
418
406
public func dispatch_group_create( ) -> dispatch_group_t {
419
- return DispatchGroup ( CDispatch . dispatch_group_create ( ) )
407
+ return dispatch_group_t ( CDispatch . dispatch_group_create ( ) )
420
408
}
421
409
422
410
public func dispatch_group_async( group: dispatch_group_t , _ queue: dispatch_queue_t ,
@@ -447,7 +435,7 @@ public func dispatch_group_leave(group:dispatch_group_t) -> Void {
447
435
448
436
public func dispatch_semaphore_create( value: Int ) -> dispatch_semaphore_t ? {
449
437
let csem = CDispatch . dispatch_semaphore_create ( value)
450
- return csem != nil ? DispatchSemaphore ( csem) : nil
438
+ return csem != nil ? dispatch_semaphore_t ( csem) : nil
451
439
}
452
440
453
441
public func dispatch_semaphore_wait( dsema: dispatch_semaphore_t , _ timeout: dispatch_time_t ) -> Int {
@@ -476,7 +464,7 @@ public var dispatch_data_empty: dispatch_data_t {
476
464
477
465
public func dispatch_data_create( buffer: UnsafePointer < Void > , _ size: size_t ,
478
466
_ queue: dispatch_queue_t , _ destructor: dispatch_block_t ? ) -> dispatch_data_t {
479
- return DispatchData ( CDispatch . dispatch_data_create ( buffer, size, queue. cobj, destructor) )
467
+ return dispatch_data_t ( CDispatch . dispatch_data_create ( buffer, size, queue. cobj, destructor) )
480
468
}
481
469
482
470
public func dispatch_data_get_size( data: dispatch_data_t ) -> size_t {
@@ -486,24 +474,24 @@ public func dispatch_data_get_size(data:dispatch_data_t)-> size_t {
486
474
public func dispatch_data_create_map( data: dispatch_data_t ,
487
475
_ buffer_ptr: UnsafeMutablePointer < UnsafePointer < Void > > ,
488
476
_ size_ptr: UnsafeMutablePointer < size_t > ) -> dispatch_data_t {
489
- return DispatchData ( CDispatch . dispatch_data_create_map ( data. cobj, buffer_ptr, size_ptr) )
477
+ return dispatch_data_t ( CDispatch . dispatch_data_create_map ( data. cobj, buffer_ptr, size_ptr) )
490
478
}
491
479
492
480
public func dispatch_data_create_concat( data1: dispatch_data_t , _ data2: dispatch_data_t ) -> dispatch_data_t {
493
- return DispatchData ( CDispatch . dispatch_data_create_concat ( data1. cobj, data2. cobj) )
481
+ return dispatch_data_t ( CDispatch . dispatch_data_create_concat ( data1. cobj, data2. cobj) )
494
482
}
495
483
496
484
public func dispatch_data_create_subrange( data: dispatch_data_t ,
497
485
_ offset: size_t , _ length: size_t ) -> dispatch_data_t {
498
- return DispatchData ( CDispatch . dispatch_data_create_subrange ( data. cobj, offset, length) )
486
+ return dispatch_data_t ( CDispatch . dispatch_data_create_subrange ( data. cobj, offset, length) )
499
487
}
500
488
501
489
// TODO: defer dispatch_data_applier_t/dispatch_data_apply
502
490
// a little unclear how best to unwrap/wrap within the block.
503
491
504
492
public func dispatch_data_copy_region( data: dispatch_data_t , _ location: size_t ,
505
493
_ offset_ptr: UnsafeMutablePointer < size_t > ) -> dispatch_data_t {
506
- return DispatchData ( CDispatch . dispatch_data_copy_region ( data. cobj, location, offset_ptr) )
494
+ return dispatch_data_t ( CDispatch . dispatch_data_copy_region ( data. cobj, location, offset_ptr) )
507
495
}
508
496
509
497
//////////
@@ -531,22 +519,22 @@ public func dispatch_io_create(type:dispatch_io_type_t,
531
519
_ fd: dispatch_fd_t ,
532
520
_ queue: dispatch_queue_t ,
533
521
_ cleanup_handler: dispatch_io_handler_block_t ) -> dispatch_io_t {
534
- return DispatchIO ( CDispatch . dispatch_io_create ( type, fd, queue. cobj, cleanup_handler) )
522
+ return dispatch_io_t ( CDispatch . dispatch_io_create ( type, fd, queue. cobj, cleanup_handler) )
535
523
}
536
524
537
525
public func dispatch_io_create_with_path( type: dispatch_io_type_t ,
538
526
_ path: UnsafePointer < Int8 > ,
539
527
_ oflag: Int32 , _ mode: mode_t ,
540
528
_ queue: dispatch_queue_t ,
541
529
_ cleanup_handler: dispatch_io_handler_block_t ) -> dispatch_io_t {
542
- return DispatchIO ( CDispatch . dispatch_io_create_with_path ( type, path, oflag, mode, queue. cobj, cleanup_handler) )
530
+ return dispatch_io_t ( CDispatch . dispatch_io_create_with_path ( type, path, oflag, mode, queue. cobj, cleanup_handler) )
543
531
}
544
532
545
533
public func dispatch_io_create_with_io( type: dispatch_io_type_t ,
546
534
_ io: dispatch_io_t ,
547
535
_ queue: dispatch_queue_t ,
548
536
_ cleanup_handler: dispatch_io_handler_block_t ) -> dispatch_io_t {
549
- return DispatchIO ( CDispatch . dispatch_io_create_with_io ( type, io. cobj, queue. cobj, cleanup_handler) )
537
+ return dispatch_io_t ( CDispatch . dispatch_io_create_with_io ( type, io. cobj, queue. cobj, cleanup_handler) )
550
538
}
551
539
552
540
// TODO: dispatch_io_handler_t (dispatch_data_t in block...)
@@ -598,7 +586,7 @@ public func dispatch_io_set_interval(channel:dispatch_io_t,
598
586
// Internal macros and helper functions. Not part of the exported API
599
587
//===----------------------------------------------------------------------===//
600
588
601
- internal let mainQueue : dispatch_queue_t = DispatchQueue ( CDispatch . dispatch_get_main_queue ( ) )
589
+ internal let mainQueue : dispatch_queue_t = dispatch_queue_t ( CDispatch . dispatch_get_main_queue ( ) )
602
590
603
591
@_silgen_name ( " _swift_dispatch_object_type_punner " )
604
592
internal func _to_dot( x: OpaquePointer ) -> CDispatch . dispatch_object_t
0 commit comments