lkml.org 
[lkml]   [2000]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: 2.4.0-test6 network socket problems
Date
From
> I've found the problem.  This type of loop does not work:
>
> do {
> alarm(t);
> read(fd);
> if (EINT)
> exception();
> else
> alarm(0);
> } while (data);
>
> There are some semantics here that differ from other *nix where this
> works. The read() won't come out when the alarm comes, and the socket
> will effectively become broken.

The restart or continue behaviour is undefined unless you use sigaction()
to control your signal behaviour (see POSIX.1 or SuS). Even then your code
is buggy on every OS I know

Suppose this happens..


alarm(1)
[sudden swap frenzy]
alarm is delivered.. do nothing
read

blocks forever. You need to make clever use of siglongjmp to avoid that one
occurring or use select/poll.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.044 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site