Hi, I’m using GServer and in “serve” method I read a string from a TCP
socket:
line = io.gets("\n")
but it can occur that the TCP connection is closed so “gets” return NIL.
In this case I just one to terminate this thread, no more.
The only way I get it working is doing:
line = io.gets("\n")
Thread.current.terminate if !line # terminate = kill = exit
Is it the appropiate way? I read the method doc but don’t understand
what exactly it does:
thr.terminate
Terminates thr and schedules another thread to be run,
returning the terminated Thread. If
this is the main thread, or the last thread, exits the process.
Thanks for any explanation.