Operating System - HP-UX
1833758 Members
3070 Online
110063 Solutions
New Discussion

Re: how to determine thread status from different thread

 
Ken_109
Advisor

how to determine thread status from different thread

I am considering building a "monitoring thread" that will have a list of detached running threads. How can I test if these running, but detached threads are still executing? I don't wish to use pthread_join, as this will block. Any ideas?Thanks.
3 REPLIES 3
Paddy_1
Valued Contributor

Re: how to determine thread status from different thread

Te options I know of :
(a)Use DCE threads by using libcma.sl and not use pthreads
(b) Use the multithreaded unsupported lib written for this purpose
http://ftp.x.org/pub/unsupported/lib/pcthreads/
(c)Use certain mechanisms in Java to achieve the same
The sufficiency of my merit is to know that my merit is NOT sufficient
Mike Stroyan
Honored Contributor

Re: how to determine thread status from different thread

If those monitored threads are cooperating, you could add a cancellation cleanup handler to each thread with pthread_cleanup_push(). Then your monitoring thread could just look at a data structure that is updated by the cancellation handler of each thread.
Ken_109
Advisor

Re: how to determine thread status from different thread

Thanks for the above suggestions:I figured out an interesting technique use pthread_getschedparam. This takes the thread id.. If the thread is not found it returns ESRCH error. I created a subroutine around this to check the thread status (ie, running,,, or ESRCH not running )...