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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:46:36+00:00 2026-06-03T22:46:36+00:00

I have a logical problem i am not sure how to solve.. Basically i

  • 0

I have a logical problem i am not sure how to solve.. Basically i have a program that starts threads based on a numericUpDown value, if the user selects 5 in the numericUpDown box 5 threads will start.

The problem is that the user also has a listbox they can fill in with info, which will be used in the threads..

So what i want to be able to do in my loop instead of looping it 5 times from the numericUpDown value is if; lets say the user enteres 10 items in the listBox, and selects to use 5 threads.. i then want all the listBox items to be queued but only have 5 run at a time..

How would i accomplish this?

Oh if it matters this is how i start my threads:

                Thread thread = new Thread(() => doTask(numeret));
                thread.IsBackground = true;
                thread.Start();
  • 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-06-03T22:46:38+00:00Added an answer on June 3, 2026 at 10:46 pm

    I believe you wish to use a ThreadPool, as explained here:

    http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx

    You need to specify the number of threads to use, and then use ThreadPool.QueueUserWorkItem to queue your tasks.

    Alternatively, you can use the parallel extensions to LinQ to perform asynchronous tasks (not the same as multithreading) – and specify the .MaxDegreesOfParalallism() value (which only sets the upper maximum)

    itemsToProcess.AsParallel().MaxDegreesOfParalallism(numThreads).ForAll(item =>
    {
        doTask(item);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with DataContextChanged not being raised on a logical child of
i have a many to many table relationship that involves 2 logical tables. Record
I have a report that needs to get data from two logical areas of
I have a logical statement that says If everyone plays the game, we will
I have a strange problem where MonoTouch seems to be either not compiling methods
If I have a javascript class that runs some initialization code, it seems logical
It seems like i have a logical problem in this loop. I am trying
Ok so I'm not even sure how to title this post but I have
I have an iPhone app in development that requires three slides (views). The problem
I have written a user control for our SharePoint site that builds an HTML

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.