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

  • Home
  • SEARCH
  • 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 6211445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:20:20+00:00 2026-05-24T06:20:20+00:00

I noticed that they don’t return pointers when created, but actual objects. So to

  • 0

I noticed that they don’t return pointers when created, but actual objects. So to get a pointer, I’m trying to declare it like this:

dispatch_queue_t* queue;
*queue = dispatch_queue_create("double_buffer_protection_queue", DISPATCH_QUEUE_SERIAL);

The C++ programmer in me says that should work, but it gives a BAD_ACCESS error, so I’m guessing I’m approaching this the wrong way.

If I want a serial queue that can be accessed by any object in my program, how do I do it? The code I showed above was meant to go in the AppDelegate class.

  • 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-24T06:20:21+00:00Added an answer on May 24, 2026 at 6:20 am

    In Grand Central Dispatch, using actual objects is proper way. For instance,

    class Manager
    {
        Manager()
        {
            m_queue = dispatch_queue_create("double_buffer_protection_queue", DISPATCH_QUEUE_SERIAL);
    
            m_worker = new Worker(m_queue);
        }
    
        ~Manager()
        {
            dispatch_release(m_queue);
            delete m_worker;
        }
    
        dispatch_queue_t m_queue;
        Worker *m_worker;
    }
    

    And then the another owner of the queue must retain and release it by itself like Objective-C objects.

    class Worker
    {
        Worker(dispatch_queue_t queue)
        // Worker(dispatch_queue_t &queue) /* reference might be ok. */
        {
            m_queue = queue;
            dispatch_retain(m_queue);
        }
    
        ~Worker()
        {
            dispatch_release(m_queue);
        }
    
        dispatch_queue_t m_queue;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that you can call Queue.Synchronize to get a thread-safe queue object, but
I noticed that JSON files don't have null values for certain properties, because they
I've been working with the Joomla framework and I have noticed that they use
In using PHP's DOM classes (DOMNode, DOMEElement, etc) I have noticed that they possess
I noticed by looking at sample code from Apple, that they tend to design
I need to localize an application and have noticed that several countries don't appear
I've noticed on bank websites, etc, my user IDs aren't saved (they don't appear
...or are they the same thing? I notice that each has its own Wikipedia
I noticed that Google maps is providing directions in my local language (hungarian) when
I noticed that my Designer.vb file of one of my forms has a lot

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.