Check if current thread is a thread pool thread

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
C# Code Snippets

C# Source Code Bank

See also …
edit

This C# code snippet checks if the current thread is a thread pool thread by examining the IsThreadPoolThread property of the current thread.

class ThreadPoolThread
{    
   public static void Main() 
   {
      Thread thread = Thread.CurrentThread;
      Console.WriteLine ("IsThreadPoolThread: {0}",
         thread.IsThreadPoolThread);
   }
}


 Thread.CurrentThread.IsThreadPoolThread (program output)
IsThreadPoolThread: False

Personal tools