Re: more probs

Date view Thread view Subject view Author view

From: Tim Wilkinson (tim@transvirtual.com)
Date: Thu Feb 11 1999 - 17:23:14 EST


Well appart from the fact that I'm an idiot and got one = in rather than
two (it should be == EAGAIN) - this problem came up on some socket tests
where I'd get EAGAIN on my Linux box and I wasn't doing any kind of
timeout thingy.

Tim

Godmar Back wrote:

> Tim,
>
> Two things:
> First, I don't understand the change you made to jthread.c.
>
> intsDisable();
> for (;;) {
> r = read(fd, buf, len);
> if (r >= 0 || !(errno == EWOULDBLOCK || errno == EINTR
> || errno == EAGAIN)) {
> break; /* real error or success */
> }
> if (errno == EINTR) {
> /* ignore */
> continue;
> }
> else if (errno = EAGAIN) {
> /* ignore - go back to sleep */
> }
> else if (haveBlocked) {
> errno = EINTR;
> break;
> }
>
> blockOnFile(fd, TH_READ, timeout);
> haveBlocked++;
> }
> if (r == -1) {
> r = errno;
> } else {
> *out = r;
> r = 0;
> }
> intsRestore();
>
> By doing so, you will not return if you time out and still can't
> read any data. Note that on most architectures, EAGAIN == EWOULDBLOCK.
> What problem are trying to fix?
>
> Second, the SoTimeout test segfaults for me. I'll check it out.
>
> - Godmar

--
  Tim Wilkinson                         Tel:     +1 510 704 1660
  Transvirtual Technologies, Inc.,      Fax:     +1 510 704 1893
  Berkeley, CA, USA.                    Email:   tim@transvirtual.com


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:58:06 EDT