views:

39

answers:

2

Hello

Two questions, I want to give a thread a name and retrieve it to check whether it is alive how to do that?

I want to do that in asp.net application at BLL layer so I don't have a timeout exception. Is that a bad idea?

Thanks

A: 

1) The System.Thread type has a string Name property. You can use that.

2) I think more information is needed to answer the second question. It would be better if you remove this from this question and ask it as a seperate question to be discussed in isolation.

AdamRalph
A: 

I know that System.Thread is having a name, but asp.net application is stateless I can't have a reference to it, the problem also I can't use the name because ProcessThread does not have a name.

foreach (ProcessThread thread in Process.GetCurrentProcess().Threads)
        {
            if (thread.Name == "Name") // does not work
            {

            }
        }
Costa