in reply to Shutdown a thread that is using a blocking socket
When I said blocking socket, I mean it's declared so that it waits on the socket instead of busy waiting round the above loop, wasting cpu.# Activate socket $read_handles = IO::Select->new(); $read_handles->add($cfg::listen_socket); # Main loop: check reads/accepts, check writes, check ready to pro +cess # Loop forever, listening for incoming msgs while (1) { # check for new information on the connections we have # NB: use blocking handles. ($new_read_handles) = IO::Select->select($read_handles, undef, undef +);
As I understand ALRM (which occurred to me), I was going to use it in the ctrl thread to give up waiting for the listen thr to shutdown after X seconds, but it seems to me that's more or less equiv to just ignoring the listen thr anyway, as it (listen thr) won't actually shutdown.$cfg::listen_socket = IO::Socket::INET->new(LocalPort => $cfg::params{'RPS_P +ORT'}, Type => SOCK_STREAM, Proto => 'tcp', Listen => SOMAXCONN, Reuse => 1, Blocking => 1 ) # Blocking is +on
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Shutdown a thread that is using a blocking socket
by chrism01 (Friar) on Mar 30, 2006 at 23:20 UTC |