Results 1 to 2 of 2
Hi,
I am new to C++ on linux, I build a client-server program in c++ on Redhat linux. In which Server is multithreaded. One thread is having infinite loop and ...
- 02-15-2009 #1Just Joined!
- Join Date
- Feb 2009
- Posts
- 3
how to exit from infinite loop as C++ program close
Hi,
I am new to C++ on linux, I build a client-server program in c++ on Redhat linux. In which Server is multithreaded. One thread is having infinite loop and keep Looking for any client Request. That mean server always keep running until or unless it is not killed by Kill [pid] command
Now my Question is , How to gracefully out from that infinite loop of server program if i close it by kill command.
Thanks
- 02-15-2009 #2
If you want to change the behaviour on a received kill signal, catch it.
Read about it in chapter "Signal Handling" in
The GNU C Library
For threads sharing common variables, I recommend
https://computing.llnl.gov/tutorials/pthreads/
(Inter-thread communication)Debian GNU/Linux -- You know you want it.


Reply With Quote