|
Re: lug-bg: Funkcii pod prekyswane w Linux-a
- Subject: Re: lug-bg: Funkcii pod prekyswane w Linux-a
- From: zezo@xxxxxxx (Cvetan Ivanov)
- Date: Sat, 30 Jan 1999 04:48:26 +0200
Luchesar Ionkov wrote:
> > btw read() se prekusva ot SIGALRM i taka se realizirat timeouti
>
> oshte po-lesno e da se izpolzwa select :))
da, no ako trqbva da se chete opredeleno kolichestvo samo ot edin file
select() e overkill.
primerno
/* install signal handler somewhere */
alarm(10);
a=fgets(buff,10,f)
ili perl:
my $result=eval {
my $r;
local $SIG{ALRM} = sub { die "timeout" };
alarm shift;
$r=<$DEVICE>;
alarm 0;
return $r;
};
za vsichki ostanali sluchai sum suglasen za select() :)
zezo
==================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
For more send to lug-bg-request@xxxxxxxxxxxx a single word 'info'
==================================================================
|
|
|