0

I have a thread name .By using that thread name how i may need to find whether the thread is alive or not. In Thread Name I have a combination of app_num and Id which helps to refer me when new thread starts.So I need to give condition that if thread is already alive for same App_num and Queue_Id then it skips starting another new thread as it already exists

Thanks in advance

3
  • The fact you want to do this suggests you are solving the 'wrong' problem. Commented Jun 10, 2013 at 3:48
  • @Mitch Wheat In Thread Name I have a combination of app_num and Id which helps to refer me when new thread starts.So I need to give condition that if thread is already alive for same App_num and Queue_Id then it skips starting another new thread as it already exists Commented Jun 10, 2013 at 4:22
  • 2
    @Chow.Net - and immediately after your check completes, the thread which was just about to exit now completely exits. By the time you act on the result of your check, there is no such thread running. That (or other such races) is probably what Mitch was trying to hint to you. It's a broken idea. Commented Jun 10, 2013 at 7:10

1 Answer 1

1

From your provided details I am expecting that you are in need of Thread.IsAlive property.

Don't forget to look at the this thread, it will help you to get threads from a process (See badbod99's solution)

Hope it helps!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.