There is no difference. There are two methods DispatchQueue.sync:
public func sync(execute block: () -> Swift.Void)
public func sync<T>(execute work: () throws -> T) rethrows -> T
: ,
sync.
get {
return self.concurrentQueue.sync { return self._name }
}
sync { ... } self._name,
. ( )
( Void):
get {
var result: String!
self.concurrentQueue.sync { result = self._name }
return result
}
, ,
.
return Void:
public func async(..., execute work: @escaping @convention(block) () -> Swift.Void)