LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-17-2008, 06:08 AM   #1
Manjunath1847
Member
 
Registered: Mar 2007
Posts: 44

Rep: Reputation: 16
How to check programatically if thread is running


I need to check if the created thread is running or not C++. I am using pthread library. I can use pthread_join(), but this is a blocking call. It does not support with timeout. Is there any other way to check if thread is running or not. In other words is there any pthread function which is similar to pthread_join which can take timeout parameter.

Thanks in advance.
 
Old 07-19-2008, 12:51 PM   #2
cmnorton
Member
 
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585

Rep: Reputation: 35
Get process info

I have not programmed P-threads on Linux, but have written Windows threaded code. Does a C API process information call have thread information in it? I would have to believe the system portion of the C rtl would have this information in a call.
 
Old 07-19-2008, 06:56 PM   #3
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
why not just fork() into a child process and call pthread_join from there? The parent function waits for a timeout period then kills the child if it has not returned.

I *think* that would work since the child inherits the parent's complete context...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting the thread running processor(cpu) id in SMP environment lxlnr Linux - Kernel 0 06-04-2007 02:55 PM
How can I get the context info for a thread/process running in user mode? LostInLinux4ever Programming 1 05-23-2007 04:00 PM
Thread is running slow for game! md_lasalle Programming 0 01-29-2007 07:31 PM
how can I check if Tor is running? bayonetblaha Linux - Newbie 1 10-13-2006 01:03 AM
´Exception in thread´ error when running Iriverter (java) JungMin Programming 3 12-10-2005 01:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration