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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:49:54+00:00 2026-05-29T23:49:54+00:00

Suppose I am doing an async connection to a web service, which by definition

  • 0

Suppose I am doing an async connection to a web service, which by definition since it is async runs in a separate thread from the main thread.

Now lets say I put this job or block of code in a serial dispatch queue. Since serial dispatch queues don’t process more than 1 job at a time, but I am sending a job that is already async, would it then consider the job to be done after the call to the async job is made? or would it actually wait for the async job to get done before processing the next job?.

What about a concurrent queue, would the concurrent generated thread, generate yet another thread to process the async operation?

EDIT: I realize my question is not really clear, so my question is:

If I am using the same serial dispatch queue, and i dispatch using dispatch_async a block of code that already performs an async operation for example a NSURLConnection – initWithRequest:delegate: that runs async, will the block be considered completed by the serial queue after the async call?, and will that async call generate yet another thread?. Or will the queue still wait for job 1 that is already async to finish before processing the second job?.

  • 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-29T23:49:55+00:00Added an answer on May 29, 2026 at 11:49 pm

    When you dispatch to a serial queue, each dispatched block is processed one after the other. So if your first block takes a long time to process, the second block will not be called until the long-running first block is finished.

    If you’re enqueueing with dispatch_async the new block is simply put to the end of the queue, the function dispatch_async immediately returns and you can go on. But the block won’t be executed until the previous blocks have finished.

    However, dispatch_sync will wait until the block got its turn to execute and finish. So in your case, dispatch_sync will block until the long-running first block has finished.

    If you dispatch to concurrent queue, then the second block will get to run in a new thread and thus the first block will not prevent the second from running.

    You could also create two queues and dedicate them to different tasks, for example have one queue only for your web service stuff and another queue for different tasks. It depends on how these operations relate to each other and which may be run in parallel and which must run one after another.

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

Sidebar

Related Questions

Hi guys I have the following VHDL which isn't doing what it suppose to
Having searched StackOverflow, and Google I think what I'm doing is suppose to be
I am doing a series of window resizing using the DeferWindowPos functionality. Suppose I
Suppose say I am doing a couple of operations. First a delete and then
Suppose I am doing matchmaking of users and games. I have models containing users
I wrote this sh script here. What it suppose to be doing is it
Suppose I am doing the following: using (OracleConnection conn = new OracleConnection(connStr)) { OracleTransaction
Suppose I am doing an insert or an update on a table. So in
I'm doing something stupid, I suppose. I swear I've done this before without issues
Suppose I have a byte[] array, I am wondering what I am really doing

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.