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-7241] libdispatch: queues getting background prio #660

Open
swift-ci opened this issue Mar 20, 2018 · 0 comments
Open

[SR-7241] libdispatch: queues getting background prio #660

swift-ci opened this issue Mar 20, 2018 · 0 comments

Comments

@swift-ci
Copy link

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

@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

1 participant