Fighting the good fight.

Move libfmt, libutf into subdirectories of lib9.

Add poll-based socket i/o to libthread, so that we can
avoid using multiple procs when possible, thus removing
dependence on crappy pthreads implementations.

Convert samterm, acme to the single-proc libthread.

Bring libcomplete, acme up-to-date w.r.t. Plan 9 distribution.
This commit is contained in:
rsc 2004-02-29 22:10:26 +00:00
parent d51419bf43
commit 5a8e63b2f0
107 changed files with 665 additions and 6637 deletions

View file

@ -99,10 +99,11 @@ extproc(void *argv)
c = arg[0];
fd = (int)arg[1];
threadfdnoblock(fd);
i = 0;
for(;;){
i = 1-i; /* toggle */
n = read(fd, plumbbuf[i].data, sizeof plumbbuf[i].data);
n = threadread(fd, plumbbuf[i].data, sizeof plumbbuf[i].data);
if(n <= 0){
fprint(2, "samterm: extern read error: %r\n");
threadexits("extern"); /* not a fatal error */
@ -165,7 +166,7 @@ extstart(void)
plumbc = chancreate(sizeof(int), 0);
arg[0] = plumbc;
arg[1] = (void*)fd;
proccreate(extproc, arg, STACK);
threadcreate(extproc, arg, STACK);
atexit(removeextern);
}
@ -226,9 +227,10 @@ plumbproc(void *argv)
fdp = arg[1];
i = 0;
threadfdnoblock(*fdp);
for(;;){
i = 1-i; /* toggle */
n = read(*fdp, plumbbuf[i].data, READBUFSIZE);
n = threadread(*fdp, plumbbuf[i].data, READBUFSIZE);
if(n <= 0){
fprint(2, "samterm: plumb read error: %r\n");
threadexits("plumb"); /* not a fatal error */
@ -258,7 +260,7 @@ plumbstart(void)
}
arg[0] =plumbc;
arg[1] = &fd;
proccreate(plumbproc, arg, STACK);
threadcreate(plumbproc, arg, STACK);
return 1;
}
#endif
@ -278,9 +280,10 @@ hostproc(void *arg)
c = arg;
i = 0;
threadfdnoblock(hostfd[0]);
for(;;){
i = 1-i; /* toggle */
n = read(hostfd[0], hostbuf[i].data, sizeof hostbuf[i].data);
n = threadread(hostfd[0], hostbuf[i].data, sizeof hostbuf[i].data);
if(n <= 0){
fprint(2, "samterm: host read error: %r\n");
threadexitsall("host");
@ -295,5 +298,5 @@ void
hoststart(void)
{
hostc = chancreate(sizeof(int), 0);
proccreate(hostproc, hostc, STACK);
threadcreate(hostproc, hostc, STACK);
}