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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:44:39+00:00 2026-05-25T19:44:39+00:00

I am having problems understanding GCD. i need to use dispatch_async to spawn the

  • 0

I am having problems understanding GCD. i need to use dispatch_async to spawn the function put_values() which will in an endless loop put values into a buffer. Get_values() will remove then also in an endless loop. I therefore have to run them at the same time without order to see if i implemented my semaphores for waiting correctly. WIll the code below do that (running them asynchronously
) ?
Thank you !

dispatch_queue_t producer = dispatch_queue_create("producer", NULL);
dispatch_queue_t consumer = dispatch_queue_create("consumer", NULL);

dispatch_async(producer, 
               ^{
                   put_values();
               });

dispatch_async(consumer, 
               ^{
                   get_values();
               });

dispatch_main();
  • 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-25T19:44:40+00:00Added an answer on May 25, 2026 at 7:44 pm

    Your code should do exactly that, unless I am missing something. Because you are using two different queues they should both run at the same time.

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

Sidebar

Related Questions

We are having a few problems understanding how best to use NHibernate. We typically
I'm having problems understanding how input to the md5 function in MySQL 4.1.22 is
I see lots of people having problems understanding rvalue references. Will ordinary C++ code
I am having real problems understanding Layouts. I am trying to put admob into
I’m learning to use the MVC 3 Framework, but I'm having some problems understanding
I was going through the Programming Ruby book and I'm having problems understanding the
I am relatively new to C++ and am having problems understanding struct. I have
I'm having problems understanding why following code leaks in one case, and not in
I'm having problems understanding how a header(Location: http://www.google.com/); can work in the middle of
I am new to C programming and I am having problems understanding common pitfalls

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.