killing a separate thread having a socket
- by user311906
Hi All
I have a separate thread ListenerThread having a socket listening to info broadcasted by some remote server. This is created at the constructor of one class I need to develop.
Because of requirements, once the separate thread is started I need to avoid any blocking function on the main thread.
Once it comes to the point of calling the destructor of my class I cannot perform a join on the listener thread so the only thing I can do is to KILL it.
My questions are:
what happens to the network resoruces allocated by the function passed to the thead? Is the socket closed properly or there might be something pending? ( most worried about this )
is this procedure fast enough i.e. is the thread killed so that interrupt immediately ?
I am working with Linux ...what command or what can I check to ensure that there is no networking resource left pending or that something went wrong for the Operating system
I thank you very much for your help
Regards
MNSTN
NOTE: I am using boost::thread in C++