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 7551669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:33:21+00:00 2026-05-30T10:33:21+00:00

I have two GCD blocks that are async. The first is for the background

  • 0

I have two GCD blocks that are async. The first is for the background thread, the second runs on the main thread. This works great, but I just saw somewhere talking that I might need to release them using dispatch_release(). E.g.:

// Use gcd
dispatch_queue_t queue = dispatch_queue_create("com.awesome", 0);
dispatch_queue_t main = dispatch_get_main_queue();

//  do the long running work in bg async queue
// within that, call to update UI on main thread.
dispatch_async(queue, ^{ 
   // Do work in the background



    // Release
    dispatch_release(queue);

   dispatch_async(main, ^{ 

       // Main


       // Release
       dispatch_release(main);

   });//end
});//end

Is this true? Do I need to release them here?

  • 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-30T10:33:23+00:00Added an answer on May 30, 2026 at 10:33 am

    Only release queues that you create; don’t release the main queue or the global concurrent queues (or, again, any you did not create yourself). It’s also not a good idea to nest the release within the work block enqueued on that queue, as you’re doing, because that’s doing it in the wrong scope and this:

    queue = dispatch_queue_create(...)
    dispatch_async(queue, ^{ something; dispatch_release(queue); });
    dispatch_async(queue, ^{ something else}); // CRASH!
    

    Won’t work when you later change the code to add that 2nd dispatch_async(). Always pairing your create/release calls in the same scope, assuming that you can, is a better stylistic choice.

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

Sidebar

Related Questions

I have two applications written in Java that communicate with each other using XML
I have two classes Order and Items I want a method like this class
I have two Hibernate data object. The first is a User (with unique id,
I have two function, one function is a reload function that does a ajax
I have used Euclid's method to find the L.C.M for two numbers. l.c.m=a*b/(gcd(a,b)) How
I have two collections, the first with an array of id's referencing documents in
I have two DataGridViews that have the same column schema (although two different DataViews
I have two lists of the same type. That type does not have an
I have two tables in MySql Company : (cname,city) works : (ename,cname,salary) I want
have two three tables one for student, second for class, and the third for

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.