swiftlang / swiftlang/swift-corelibs-libdispatch

[SR-5725] DispatchQueue.apply is unavailable

Open
#683 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Improvement libdispatch
Dominant language
C
Stars
2.6k
Forks
496
Avg merge
2d 6h
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the imported dispatch_apply diagnostic and comparing it with the DispatchQueue and DispatchQueue.concurrentPerform APIs described in the issue. Determine where the Swift DispatchQueue surface is defined and how its availability is tested; done means the requested queue-controlled apply API is available with consistent diagnostics and its behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.