develooper Front page | perl.ithreads | Postings from September 2010

RE: Killing a thread

Thread Previous | Thread Next
September 30, 2010 01:00
RE: Killing a thread
Message ID:
Hi Ajeet,
	Do you have an example you can provide? I prefer not to loop
around (like sleep for 60 seconds and check again) checking for the
total time and then kill the thread if it takes too long.

Sincerely yours,
Danny H. Wong

-----Original Message-----
From: Ajeet Kumar [] 
Sent: Wednesday, September 29, 2010 2:34 AM
To: Danny Wong (dannwong);
Subject: RE: Killing a thread

Hello Wong,

Following is my approach in this case...

--Execute the "ps -A" command
-- Observe the third column , which is total time taken by process
-- check the process ID from the first column
-- send a kill -9 signal to required process ID

If any confusion is left, then do mail back...

-----Original Message-----
From: Danny Wong (dannwong) []
Sent: Wednesday, September 29, 2010 4:12 AM
Subject: Killing a thread

Hi Perl Thread GURUS,
        Here is my situation. I started, say 10 threads, executing some
command, 1 or 2 of them is hanging for over 2 hours. I want to put in
some logic that if the thread run time passes an hour threshold kill
that thread or return and fail the thread. Any ideas on how I can
accomplish this task? Thanks.

Sincerely yours,
Danny H. Wong

"DISCLAIMER: This message is proprietary to Aricent and is intended
solely for the use of the individual to whom it is addressed. It may
contain privileged or confidential information and should not be
circulated or used for any purpose other than for what it is intended.
If you have received this message in error, please notify the originator
immediately. If you are not the intended recipient, you are notified
that you are strictly prohibited from using, copying, altering, or
disclosing the contents of this message. Aricent accepts no
responsibility for loss or damage arising from the use of the
information transmitted by this email including damage from virus."

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About