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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:28:02+00:00 2026-06-18T02:28:02+00:00

By default the thread pool in .NET works with background threads. I can’t change

  • 0

By default the thread pool in .NET works with background threads.

I can’t change it to run as foreground.

How do I change this to run as foreground threads?

Edit:

I need to use this because I’m changing my App due high volume processing (before it I was manually handling threads, which are Foreground ones by default), and I don’t want to change my Application just to adapt it to a background threading scenario..

I’m wondering why Thread pool is not Foreground by default

  • 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-18T02:28:03+00:00Added an answer on June 18, 2026 at 2:28 am

    The notion of a “background thread” means very little in .NET. The Thread.IsBackground property is just a simple flag that helps the CLR decide whether or not it should rudely abort the thread when the AppDomain gets unloaded or whether it should wait for the thread to exit voluntarily.

    You can just change the property if you want a thread-pool thread to keep running at program exit. This snippet shows how that’s possible:

    using System;
    using System.Threading;
    
    class Program {
        static void Main(string[] args) {
            var sync = new ManualResetEvent(false);
            ThreadPool.QueueUserWorkItem((_) => {
                Console.WriteLine("Running");
                Thread.CurrentThread.IsBackground = false;
                sync.Set();
                Thread.Sleep(5000);
                Console.WriteLine("Done, should exit now");
                Thread.Sleep(250);
            });
            sync.WaitOne();  // Ensures IsBackground is set
        }
    }
    

    Do keep your eyes on the ball here. If this is important to you then there’s a high likelihood you are doing something wrong.

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

Sidebar

Related Questions

Taken from Microsoft documentation: By default, the thread pool has 250 worker threads per
how many number of thread per process default in the system.thread.threadpool in asp.net 3.5
I want a message board thread by default visible for a role. No need
The default strongly-typed Edit page in ASP.NET MVC 3 generally exposes all fields for
I notice that default tomcat 7 thread pool size seems to be 200. But
I need to implement a thread pool executor for generic tasks. My idea is
This is my Quartz configuration: <quartz> <add key="quartz.scheduler.instanceName" value="EmailScheduler" /> <!-- Configure Thread Pool
I made a thread pool based on the example on this page . In
By default, the ordered list looks like this: There are some spacing on the
If I set the CurrentCulture of a thread pool thread, what happens when the

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.