~mdw
/
fwd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0dca8d9
)
Use `sel_force' to avoid a `select' call between reads and writes.
author
mdw
<mdw>
Tue, 31 Aug 1999 17:42:49 +0000
(17:42 +0000)
committer
mdw
<mdw>
Tue, 31 Aug 1999 17:42:49 +0000
(17:42 +0000)
chan.c
patch
|
blob
|
blame
|
history
diff --git
a/chan.c
b/chan.c
index
72938da
..
ad44891
100644
(file)
--- a/
chan.c
+++ b/
chan.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: chan.c,v 1.
3 1999/07/27 18:30:53
mdw Exp $
+ * $Id: chan.c,v 1.
4 1999/08/31 17:42:49
mdw Exp $
*
* Channel management
*
*
* Channel management
*
@@
-29,6
+29,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: chan.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: chan.c,v $
+ * Revision 1.4 1999/08/31 17:42:49 mdw
+ * Use `sel_force' to avoid a `select' call between reads and writes.
+ *
* Revision 1.3 1999/07/27 18:30:53 mdw
* Various minor portability fixes.
*
* Revision 1.3 1999/07/27 18:30:53 mdw
* Various minor portability fixes.
*
@@
-167,8
+170,10
@@
static void readchan(int fd, unsigned mode, void *vp)
}
else if (r == 0)
goto close;
}
else if (r == 0)
goto close;
- else if (c->len == 0 && (c->f & CHANF_READY))
+ else if (c->len == 0 && (c->f & CHANF_READY))
{
sel_addfile(&c->w);
sel_addfile(&c->w);
+ sel_force(&c->w);
+ }
c->len += r;
if (c->len == CHAN_BUFSZ)
sel_rmfile(&c->r);
c->len += r;
if (c->len == CHAN_BUFSZ)
sel_rmfile(&c->r);
@@
-178,8
+183,10
@@
static void readchan(int fd, unsigned mode, void *vp)
close:
c->f |= CHANF_CLOSE;
close:
c->f |= CHANF_CLOSE;
- if (!c->len && (c->f & CHANF_READY))
+ if (!c->len && (c->f & CHANF_READY))
{
sel_addfile(&c->w);
sel_addfile(&c->w);
+ sel_force(&c->w);
+ }
sel_rmfile(&c->r);
}
sel_rmfile(&c->r);
}
@@
-216,8
+223,10
@@
void chan_dest(chan *c, int fd)
if (c->f & CHANF_READY)
return;
sel_initfile(sel, &c->w, fd, SEL_WRITE, writechan, c);
if (c->f & CHANF_READY)
return;
sel_initfile(sel, &c->w, fd, SEL_WRITE, writechan, c);
- if (c->len || (c->f & CHANF_CLOSE))
+ if (c->len || (c->f & CHANF_CLOSE))
{
sel_addfile(&c->w);
sel_addfile(&c->w);
+ sel_force(&c->w);
+ }
c->f |= CHANF_READY;
}
c->f |= CHANF_READY;
}