swiftlang / swiftlang/swift-corelibs-libdispatch
[SR-7241] libdispatch: queues getting background prio
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2.6k
- Forks
- 496
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 3
Description
| Previous ID | SR-7241 |
| Radar | None |
| Original Reporter | Kurkin (JIRA User) |
| Type | Bug |
Environment
linux without pthread_workqueue_init, so HAVE_PTHREAD_WORKQUEUE_QOS is 0
Additional Detail from JIRA
| Votes | 0 |
| Component/s | libdispatch |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 713ccb4651173e9742d05928621b4bd0
Issue Description:
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
goes to
dispatch_queue_t
dispatch_get_global_queue(long priority, unsigned long flags)
{
if (flags & ~(unsigned long)DISPATCH_QUEUE_OVERCOMMIT) {
return DISPATCH_BAD_INPUT;
}
dispatch_qos_t qos = _dispatch_qos_from_queue_priority(priority); <---
#if !HAVE_PTHREAD_WORKQUEUE_QOS
if (qos == QOS_CLASS_MAINTENANCE) {
qos = DISPATCH_QOS_BACKGROUND;
} else if (qos == QOS_CLASS_USER_INTERACTIVE) {
qos = DISPATCH_QOS_USER_INITIATED;
}
#endif
if (qos == DISPATCH_QOS_UNSPECIFIED) {
return DISPATCH_BAD_INPUT;
}
return _dispatch_get_root_queue(qos, flags & DISPATCH_QUEUE_OVERCOMMIT);
}
goes to
_dispatch_qos_from_queue_priority where DISPATCH_QUEUE_PRIORITY_HIGH mapped to DISPATCH_QOS_USER_INITIATED(5) and DISPATCH_QOS_USER_INITIATED(5) is equal to QOS_CLASS_MAINTENANCE(5) and we are getting queue with wrong prio
Expected Results:
High prio queue
Actual Results:
Background prio queue
Version/Build:
master libdispatch
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing dispatch_get_global_queue through _dispatch_qos_from_queue_priority on Linux when HAVE_PTHREAD_WORKQUEUE_QOS is 0, focusing on the shown priority and QoS values. Reproduce the DISPATCH_QUEUE_PRIORITY_HIGH call and verify that it produces a high-priority queue rather than a background-priority queue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100