LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Stopping a Thread (https://www.linuxquestions.org/questions/linux-newbie-8/stopping-a-thread-788615/)

kumar.ramadoss 02-12-2010 01:52 AM

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

chrism01 02-12-2010 02:00 AM

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.

Web31337 02-12-2010 02:06 AM

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.


All times are GMT -5. The time now is 08:46 PM.