@@ -201,6 +201,11 @@ public extension DispatchSource {
201
201
let source = dispatch_source_create ( _swift_dispatch_source_type_data_or ( ) , 0 , 0 , queue? . __wrapped)
202
202
return DispatchSource ( source: source) as DispatchSourceUserDataOr
203
203
}
204
+
205
+ public class func makeUserDataReplaceSource( queue: DispatchQueue ? = nil ) -> DispatchSourceUserDataReplace {
206
+ let source = dispatch_source_create ( _swift_dispatch_source_type_data_replace ( ) , 0 , 0 , queue? . __wrapped)
207
+ return DispatchSource ( source: source) as DispatchSourceUserDataReplace
208
+ }
204
209
205
210
#if !os(Linux) && !os(Android)
206
211
public class func makeFileSystemObjectSource( fileDescriptor: Int32 , eventMask: FileSystemEvent , queue: DispatchQueue ? = nil ) -> DispatchSourceFileSystemObject {
@@ -318,45 +323,48 @@ public extension DispatchSourceFileSystemObject {
318
323
#endif
319
324
320
325
public extension DispatchSourceUserDataAdd {
321
- /// @function mergeData
322
- ///
323
- /// @abstract
324
- /// Merges data into a dispatch source of type DISPATCH_SOURCE_TYPE_DATA_ADD or
325
- /// DISPATCH_SOURCE_TYPE_DATA_OR and submits its event handler block to its
326
- /// target queue.
326
+ /// Merges data into a dispatch source of type `DISPATCH_SOURCE_TYPE_DATA_ADD`
327
+ /// and submits its event handler block to its target queue.
327
328
///
328
- /// @param value
329
- /// The value to coalesce with the pending data using a logical OR or an ADD
330
- /// as specified by the dispatch source type. A value of zero has no effect
331
- /// and will not result in the submission of the event handler block.
329
+ /// - parameter data: the value to add to the current pending data. A value of zero
330
+ /// has no effect and will not result in the submission of the event handler block.
332
331
public func add( data: UInt ) {
333
332
dispatch_source_merge_data ( ( self as! DispatchSource ) . __wrapped, data)
334
333
}
335
334
}
336
335
337
336
public extension DispatchSourceUserDataOr {
338
- /// @function mergeData
339
- ///
340
- /// @abstract
341
- /// Merges data into a dispatch source of type DISPATCH_SOURCE_TYPE_DATA_ADD or
342
- /// DISPATCH_SOURCE_TYPE_DATA_OR and submits its event handler block to its
343
- /// target queue.
337
+ /// Merges data into a dispatch source of type `DISPATCH_SOURCE_TYPE_DATA_OR` and
338
+ /// submits its event handler block to its target queue.
344
339
///
345
- /// @param value
346
- /// The value to coalesce with the pending data using a logical OR or an ADD
347
- /// as specified by the dispatch source type. A value of zero has no effect
348
- /// and will not result in the submission of the event handler block.
340
+ /// - parameter data: The value to OR into the current pending data. A value of zero
341
+ /// has no effect and will not result in the submission of the event handler block.
349
342
public func or( data: UInt ) {
350
343
dispatch_source_merge_data ( ( self as! DispatchSource ) . __wrapped, data)
351
344
}
352
345
}
353
346
347
+ public extension DispatchSourceUserDataReplace {
348
+ /// Merges data into a dispatch source of type `DISPATCH_SOURCE_TYPE_DATA_REPLACE`
349
+ /// and submits its event handler block to its target queue.
350
+ ///
351
+ /// - parameter data: The value that will replace the current pending data.
352
+ /// A value of zero will be stored but will not result in the submission of the event
353
+ /// handler block.
354
+ public func replace( data: UInt ) {
355
+ dispatch_source_merge_data ( ( self as! DispatchSource ) . __wrapped, data)
356
+ }
357
+ }
358
+
354
359
@_silgen_name ( " _swift_dispatch_source_type_DATA_ADD " )
355
360
internal func _swift_dispatch_source_type_data_add( ) -> dispatch_source_type_t
356
361
357
362
@_silgen_name ( " _swift_dispatch_source_type_DATA_OR " )
358
363
internal func _swift_dispatch_source_type_data_or( ) -> dispatch_source_type_t
359
364
365
+ @_silgen_name ( " _swift_dispatch_source_type_DATA_REPLACE " )
366
+ internal func _swift_dispatch_source_type_data_replace( ) -> dispatch_source_type_t
367
+
360
368
#if HAVE_MACH
361
369
@_silgen_name ( " _swift_dispatch_source_type_MACH_SEND " )
362
370
internal func _swift_dispatch_source_type_mach_send( ) -> dispatch_source_type_t
0 commit comments