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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:28:38+00:00 2026-05-30T04:28:38+00:00

I create dynamic threads in C# and I need to get the status of

  • 0

I create dynamic threads in C# and I need to get the status of those running threads.

List<string>[] list;
list = dbConnect.Select();

for (int i = 0; i < list[0].Count; i++)
{
    Thread th = new Thread(() =>{
        sendMessage(list[0]['1']);
        //calling callback function
    });
    th.Name = "SID"+i;
    th.Start();
}

for (int i = 0; i < list[0].Count; i++)
{
    // here how can i get list of running thread here.
}

How can you get list of running threads?

  • 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-30T04:28:40+00:00Added an answer on May 30, 2026 at 4:28 am

    Create a List<Thread> and store each new thread in your first for loop in it.

    List<string>[] list;
    List<Thread> threads = new List<Thread>();
    list = dbConnect.Select();
    
    for (int i = 0; i < list[0].Count; i++)
    {
        Thread th = new Thread(() =>{
            sendMessage(list[0]['1']);
            //calling callback function
        });
        th.Name = "SID"+i;
        th.Start();
        threads.add(th)
    }
    
    for (int i = 0; i < list[0].Count; i++)
    {
        threads[i].DoStuff()
    }
    

    However if you don’t need i you can make the second loop a foreach instead of a for


    As a side note, if your sendMessage function does not take very long to execute you should somthing lighter weight then a full Thread, use a ThreadPool.QueueUserWorkItem or if it is available to you, a Task

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

Sidebar

Related Questions

I create dynamic LinkButton and I add LinkButton's Click Trigger to UpdatePanel. Now, When
I want to create dynamic content based on this. I know it's somewhere, as
How to create dynamic label and button in flex 3?
How does one create Dynamic CSS and JavaScript On-The-Fly (using PHP). This needs to
Our PHP scripts create dynamic folders and files and we are having a permission
I want to create dynamic tabPages in TabControl. In each tabPage I create dataGridView
Does python have the ability to create dynamic keywords? For example: qset.filter(min_price__usd__range=(min_price, max_price)) I
I just wanna ask if there's a way in C#/ASP.NET to create 'dynamic' tables/fields
I create some dynamic textbox's and a button in a placeholder and would like
I wish to create a dynamic RSS feed to represent my site's content. Currently,

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.