From f1ce090bd12cb4478c9226eded7e8ecf0917e377 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 16 Jun 2007 02:13:26 +0200 Subject: [PATCH 1/1] Hopefully fix the infamous select issues. --- remoteglot.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/remoteglot.pl b/remoteglot.pl index c64fb41..4911b2c 100644 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -63,10 +63,11 @@ $t->cmd("observe $target"); print "FICS ready.\n"; while (1) { my $rin = ''; + my $rout; vec($rin, fileno(UCIREAD), 1) = 1; vec($rin, fileno($t), 1) = 1; - my ($nfound, $timeleft) = select($rin, undef, undef, 5.0); + my ($nfound, $timeleft) = select($rout=$rin, undef, undef, 5.0); my $sleep = 1.0; while (1) { @@ -89,7 +90,7 @@ while (1) { } # any fun on the UCI channel? - if (vec($rin, fileno(UCIREAD), 1)) { + if ($nfound > 0 && vec($rout, fileno(UCIREAD), 1) == 1) { my $line = ; chomp $line; $line =~ tr/\r//d; -- 2.39.2