Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7661331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:35:02+00:00 2026-05-31T13:35:02+00:00

What is the best/simplest way to detect if a queue I have created is

  • 0

What is the best/simplest way to detect if a queue I have created is currently in use? My intent here is to defer a particular action until all queued tasks have completed.

Thanks,
Doug

UPDATE

Here is a bit more context. I have an async serial queue (private dispatch queue) that is a property of my object. When this queue completes its work it calls dispatch_async(dispatch_get_main_queue(), {...}) to up date the UI. Currently the app runs only in landscape interface orientation. I am now adding support for both portrait & landscape interface orientation. For now, I prefer not to allow the interface to rotate to/from portrait/landscape while my GCD async task is running. So in my controller’s shouldAutorotateToInterfaceOrientation: method I want to return NO during those periods.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:35:03+00:00Added an answer on May 31, 2026 at 1:35 pm

    There’s no direct support for that in GCD. You can probably get the effect you’re looking for in other ways, though.

    • Do you just want to run a block after other blocks have completed? Put the blocks in a dispatch_group, and submit your “after everything’s done action” using dispatch_group_notify. This works with concurrent or sequential queues.

    • Similarly, put your blocks in a group, and call dispatch_group_wait(group, DISPATCH_TIME_NOW). If it returns non-zero, then there are outstanding blocks in the group.

    • Is your queue sequential, and you want to wait until the other blocks have completed, blocking the current thread until then? Just issue your handler using dispatch_sync on the same queue.

    There are other possibilities, depending on your exact situation.

    Edit: Based on your update, there’s an even easier way:

    • add a BOOL property to your view controller, called allowsOrientationChange
    • override -shouldAutorotateToInterfaceOrientation: to return self.allowsOrientationChange
    • at the start of your work block, do a dispatch_async to set the property to NO
    • at the end of your work block, do a dispatch_async to set the property to YES

    (There’s a little bit of a race condition between when the property is set to NO on the main thread, and when the rest of your work happens in the queue. You could make it a dispatch_sync if that really matters. Depends on what your reasons are for preventing rotation, I suppose.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the best / simplest / most accurate way to detect the browser of
Does anyone have any suggestions for the best / simplest way to view all
Firstly, what is the best/simplest way to detect if X11 is running and available
I'm wondering what is the best (fastest and simplest) way to have a textfield
What would be the best way (ideally, simplest) to convert an int to a
Best to use an example to describe the problem. Lets say I have a
what is the best and most simplest way to create tooltip text for textboxes
What is the correct/best/simplest way to convert a c-style string to a std::string. The
What is the simplest/best way to ensure only one instance of a given script
I would like to know what the simplest/best way for obtaining information about the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.