1826270 Members
3660 Online
109692 Solutions
New Discussion

is thread alive ?

 
pthread
New Member

is thread alive ?

Hi,

Is there a API in pthread to get the state of the thread on hp-ux ?

State of the thread I meant by what time the thread started, whether the
thread still exists.

I could find pstat_getlwp but it would take lwpid as the argument ? any
alternatives of converting a pthread_t to lwp willalso help ..

regards

Shankar K E

5 REPLIES 5
Dennis Handly
Acclaimed Contributor

Re: is thread alive ?

Same as kill, checks but doesn't kill it: pthread_kill(thread, 0);
http://docs.hp.com/en/B2355-60130/pthread_kill.3T.html
pthread
New Member

Re: is thread alive ?

Hi Dennis,

Thanks for the reply.

But if the pthread_id gets reused then I have to use the
start time of the thread, is there an API to do that in
the pthread library ?

Thanks

Shankar
Dennis Handly
Acclaimed Contributor

Re: is thread alive ?

>But if the pthread_id gets reused then I have to use the start time of the thread, is there an API to do that in the pthread library?

In a simple case I tried, I didn't see any reuse of the thread id but I don't think that is guaranteed.
pthread
New Member

Re: is thread alive ?

So we have to need an API from pthread right ?

pstat_getlwp returns a very good piece of information, is there any in the same manner of pthread.

Dennis Handly
Acclaimed Contributor

Re: is thread alive ?

>So we have to need an API from pthread right?

You need to remember all of the threads you created and make sure you remove the ones that die.