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 always keep in 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 exit from that infinite loop server program gets close by kill command.

Thanks



Hi,

When ever you want to stop the server you can stop the thread by using exit or cancel system calls and after that you can stop the main process.

if you are using pthreads then pthread_exit() or pthread_cancel() call can stop your thread where you are looking for client requests.
Topic archived. No new replies allowed.