--- loncom/Attic/lonc 2002/03/26 04:37:59 1.35 +++ loncom/Attic/lonc 2002/03/27 04:07:02 1.36 @@ -5,7 +5,7 @@ # provides persistent TCP connections to the other servers in the network # through multiplexed domain sockets # -# $Id: lonc,v 1.35 2002/03/26 04:37:59 foxr Exp $ +# $Id: lonc,v 1.36 2002/03/27 04:07:02 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -592,6 +592,36 @@ sub HandleInput } } +# DoSelect: does a select with no timeout. On signal (errno == EINTR), +# the select is retried until there are items in the returned +# vectors. +# +# Parameters: +# \$readvec - Reference to a vector of file descriptors to +# check for readability. +# \$writevec - Reference to a vector of file descriptors to check for +# writability. +# On exit, the referents are modified with vectors indicating which +# file handles are readable/writable. +# +sub DoSelect { + my $readvec = shift; + my $writevec= shift; + my $outs; + my $ins; + + while (1) { + my $nfds = select($outs = $$writevec, $ins = $$readvec, undef, undef); + if($nfound) { + $$readvec = $ins; + $$writevec = $outs; + return; + } else { + die "Select failed" unless $! == EINTR; + } + } +} + # handle($socket) deals with all pending requests for $client # sub handle {