I am writing a HTTP THREAD-POOLED WEB SERVER code. I made my code at my best. It works fine also.
But there is one problem, whenever I want to shut down my server, I have to use CTRL + C
. But that is a bad way to shut down.
I think a lot, to add shutdown feature in my code. But I am unable to do that.
Please help me to add this feature, give any suggestion to do that, I will definitely code that.
EDIT NO. 1
One method that I think is to make one thread that is only listening STDIN input given by keyboard. Whenever it gets "SHUTDOWN". It calls ThreadPol.shutdown()
. This way I can achieve this goal.
Is this a right method ? If yes, please help me to implement this.