একটি থ্রেড পরিচালিত থ্রেড পুলের অন্তর্গত কিনা তা পরীক্ষা করতে, কোডটি নিম্নরূপ -
উদাহরণ
using System;
using System.Threading;
public class Demo {
public static void Main() {
Thread thread = new Thread(new ThreadStart(demo));
thread.Start();
}
public static void demo() {
Console.WriteLine("Thread belongs to managed thread pool? = "+Thread.CurrentThread.IsThreadPoolThread);
}
} আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেThread belongs to managed thread pool? = False
উদাহরণ
আসুন আরেকটি উদাহরণ দেখি -
using System;
using System.Threading;
public class Demo {
public static void Main() {
ThreadPool.QueueUserWorkItem(new WaitCallback(demo));
}
public static void demo(object stateInfo) {
Console.WriteLine("Thread belongs to managed thread pool? = "+Thread.CurrentThread.IsThreadPoolThread);
}
} আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেThread belongs to managed thread pool? = True