Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-5725] DispatchQueue.apply is unavailable #683

Open
sharplet opened this issue Aug 21, 2017 · 3 comments
Open

[SR-5725] DispatchQueue.apply is unavailable #683

sharplet opened this issue Aug 21, 2017 · 3 comments

Comments

@sharplet
Copy link

Previous ID SR-5725
Radar rdar://problem/34162804
Original Reporter @sharplet
Type Improvement
Environment

Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 0
Component/s libdispatch
Labels Improvement
Assignee ktopley-apple (JIRA)
Priority Medium

md5: 2bebab35e0011d92df8ef134f2df0ba5

Issue Description:

The diagnostics for the imported version of dispatch_apply(3) are contradictory:

  1> import Dispatch
  2> dispatch_apply
error: repl.swift:2:1: error: 'dispatch_apply' has been replaced by 'DispatchQueue.apply(attributes:iterations:execute:)'
dispatch_apply
^~~~~~~~~~~~~~
DispatchQueue.apply


  2> DispatchQueue.main.apply
error: repl.swift:2:15: error: value of type 'DispatchQueue' has no member 'apply'
DispatchQueue.main.apply
~~~~~~~~~~~~~~^~~~ ~~~~~


  2> DispatchQueue.apply
error: repl.swift:2:1: error: type 'DispatchQueue' has no member 'apply'
DispatchQueue.apply
^~~~~~~~~~~~~ ~~~~~


  2> DispatchQueue(label: "").apply
error: repl.swift:2:1: error: value of type 'DispatchQueue' has no member 'apply'
DispatchQueue(label: "").apply
^~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~

The DispatchQueue.concurrentPerform() API provides an alternative, but doesn't allow controlling the queue that work will be executed on.

@swift-ci
Copy link

Comment by Pierre Habouzit (JIRA)

Controlling the queue to execute work on is a misfeature of dispatch_apply(), there are almost no valid use for it, which is why it was never made available to swift, and there's no plan to change this at this time.

We should fix the diagnostics so that dispatch_apply() redirects to concurrentPErform.

@swift-ci
Copy link

Comment by Kim Topley (JIRA)

Filed [rdar://problem/34162804] for this.

@benrimmington
Copy link

It looks like this was fixed in apple/swift#11777 for the SDK overlay.

Does the Private.swift file in swift-corelibs-libdispatch also need to be updated?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants