LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   kill -9 for ncurses application problem (https://www.linuxquestions.org/questions/programming-9/kill-9-for-ncurses-application-problem-385113/)

arunka 11-21-2005 05:42 AM

kill -9 for ncurses application problem
 
hi all
i have written a muti-threaded application using ncurses.
Now if i give a command "kill -9 <pid of the any thread>"
sometimes i am console is not returning to normal mode, though all the threads are getting killed.

Do anyone has an idea why it is happenning???

Thanks in advance.

Arun KA

crabboy 11-21-2005 10:58 AM

ncurses is chaning the properties of your console to get it to do what it wants. Killing the process with -9 does not allow ncurses to clean up it's mess and set your console properties back to the original settings.

You can try running an 'stty sane' after the program exists to see if those settings give you something that you can work with without restarting your window.

dogpatch 11-27-2005 12:09 PM

I think handling the term signal inside your code will avoid this. Somewhere near the startup of your program, include the following:



Code:

signal(SIGTERM,MyTermRtn);
with a routine to handle this condition:

Code:

void MyTermRtn(){
        endwin(); /* tell ncurses to clean up */
        (other term logic)
        }



All times are GMT -5. The time now is 12:23 PM.