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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:48:45+00:00 2026-05-23T03:48:45+00:00

At first I have thread waiting example and it works perfect. It’s job is

  • 0

At first I have thread waiting example and it works perfect. It’s job is ask 100 threads wait 3 seconds and then make output:

for (int i = 0; i < 100; ++i)
{
    int index = i;
    Thread t = new Thread(() =>
        {
            Caller c = new Caller();
            c.DoWaitCall();
        }) { IsBackground = true };
    t.Start();
}

the Caller::DoWaitCall() looks like:

public void DoWaitCall()
{
    Thread.Sleep(3000);
    Console.WriteLine("done");
}

In this case, all threads wait 3 seconds and give output message almost in same time.

But when I try to use Async callback to do the Console.WriteLine:

    public void DoWaitCall()
    {
        MyDel del = () => { Thread.Sleep(3000); };
        del.BeginInvoke(CallBack, del);
    }

    private void CallBack(IAsyncResult r)
    {
        Console.WriteLine("done");
    }

Each thread wait for different time, and make their output one-by-one slowly.
Is there any good way to achieve async callback in parallel?

  • 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-23T03:48:46+00:00Added an answer on May 23, 2026 at 3:48 am

    The effect you’re seeing is the ThreadPool ramping up gradually, basically. The idea is that it’s relatively expensive to create (and then keep) threads, and the ThreadPool is designed for short-running tasks. So if it receives a bunch of tasks in a short space of time, it makes sense to batch them up, only starting new threads when it spots that there are still tasks waiting a little bit later.

    You can force it to keep a minimum number of threads around using ThreadPool.SetMinThreads. For real systems you shouldn’t normally need to do this, but it makes sense for a demo or something similar.

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

Sidebar

Related Questions

I have an application that has two threads. The first one (the main thread)
I have some unsolved issue with threads. It's my first time doing it. I
If I have a synchronized method and two threads are waiting to enter it
I found the following semaphore example. I'm currently learning about thread syncing. I have
You have two threads, a and b. Thread a is in a forever loop,
In order to bring up the menu for a DataGridViewComboBoxCell, I first have to
First I have a Listbox and set the DataSource to a MyObjectCollection MyObjectCollection implements
First I have a PHP file that gets data and file from a HTML
I have First/Last/Previous/Next buttons that change the selected child node of a TreeViewItem. Setting
I have first: select url from urls where site = '$value' order by url

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.