Skip to content

Commit

Permalink
Makes the DispatchIO initializer that accepts a path failable, reflec…
Browse files Browse the repository at this point in the history
…ting the fact that a relative or non-existent path is invalid.

(Radar 31115994)
  • Loading branch information
ktopley-apple committed Mar 20, 2017
1 parent 1cc64e1 commit d137aa4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/swift/IO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public extension DispatchIO {
self.init(__type: type.rawValue, fd: fileDescriptor, queue: queue, handler: cleanupHandler)
}

@available(swift, obsoleted: 4)
public convenience init(
type: StreamType,
path: UnsafePointer<Int8>,
Expand All @@ -66,6 +67,18 @@ public extension DispatchIO {
self.init(__type: type.rawValue, path: path, oflag: oflag, mode: mode, queue: queue, handler: cleanupHandler)
}

@available(swift, introduced: 4)
public convenience init?(
type: StreamType,
path: UnsafePointer<Int8>,
oflag: Int32,
mode: mode_t,
queue: DispatchQueue,
cleanupHandler: @escaping (_ error: Int32) -> Void)
{
self.init(__type: type.rawValue, path: path, oflag: oflag, mode: mode, queue: queue, handler: cleanupHandler)
}

public convenience init(
type: StreamType,
io: DispatchIO,
Expand Down

0 comments on commit d137aa4

Please sign in to comment.