LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-12-2010, 01:52 AM   #1
kumar.ramadoss
LQ Newbie
 
Registered: Feb 2010
Posts: 2

Rep: Reputation: 0
Stopping a Thread


Hi Experts,

How to stop a thread by using commands? Other threads in that process shouldn't disturbed.
Is it possible to do the same?
I need something similar to kill, which is used to stop a process.

Thanks,
kumar
 
Old 02-12-2010, 02:00 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,254

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Processes cannot be signalled directly from outside the process.
What I've done in the past is to write a trap (essentially a callback routine) for a signal eg SIGHUP which then eg re-reads the cfg file, in which I've set a value to tell it to terminate or whatever.
Of course, if its a server listening on a socket, you could send a special msg that it recognises.
 
1 members found this post helpful.
Old 02-12-2010, 02:06 AM   #3
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
Probably a best way of doing so is to code your application the way it is possible to stop some thread while running.
Interesting question.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
worker thread queue (or thread pool) in C under linux? matth45 Programming 7 03-13-2012 08:19 AM
python thread safety: printing from thread to redirected stdout - safe? BrianK Programming 2 10-11-2010 12:28 PM
thread creating another thread on 2.4 kernel after long run ashok449 Linux - Kernel 1 02-20-2009 05:26 AM
the return value of getpid() called from main thread and new thread r identical !!! cryincold Programming 3 02-29-2008 02:37 AM


All times are GMT -5. The time now is 06:41 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration