diff options
author | rsc <devnull@localhost> | 2004-12-26 02:10:47 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-12-26 02:10:47 +0000 |
commit | f99790979b4a659d7f6e490fbb8b26d630804eed (patch) | |
tree | 9f64ab5ea6faedb80fd2231faed4d42da51a471b /src/cmd/draw | |
parent | 6a5c5d48705ef8374f5172731408f0f27b0f0dc6 (diff) | |
download | plan9port-f99790979b4a659d7f6e490fbb8b26d630804eed.tar.gz plan9port-f99790979b4a659d7f6e490fbb8b26d630804eed.tar.bz2 plan9port-f99790979b4a659d7f6e490fbb8b26d630804eed.zip |
update to use new thread library
Diffstat (limited to 'src/cmd/draw')
-rw-r--r-- | src/cmd/draw/mkfile | 8 | ||||
-rw-r--r-- | src/cmd/draw/stats.c | 23 |
2 files changed, 22 insertions, 9 deletions
diff --git a/src/cmd/draw/mkfile b/src/cmd/draw/mkfile index a12abd81..bdb33086 100644 --- a/src/cmd/draw/mkfile +++ b/src/cmd/draw/mkfile @@ -5,10 +5,14 @@ SHORTLIB=draw bio 9 <$PLAN9/src/mkmany +$O.tcolors: tcolors.$O + $LD -o $target tcolors.$O -ldraw -lthread -l9 $LDFLAGS + $O.mc: mc.$O - $LD -o $target mc.$O -lfs -lmux -lthread -ldraw -lbio -l9 $LDFLAGS + $LD -o $target mc.$O -lfs -lmux -ldraw -lthread -lbio -l9 $LDFLAGS $O.stats: stats.$O - $LD -o $target stats.$O -lthread -ldraw -lbio -l9 $LDFLAGS + $LD -o $target stats.$O -ldraw -lthread -lbio -l9 $LDFLAGS LDFLAGS=$LDFLAGS -L$X11/lib -lX11 + diff --git a/src/cmd/draw/stats.c b/src/cmd/draw/stats.c index 2f606467..87326cda 100644 --- a/src/cmd/draw/stats.c +++ b/src/cmd/draw/stats.c @@ -666,14 +666,15 @@ keyboardthread(void *v) killall("quit"); } -void machthread(void*); +void machproc(void*); +void updateproc(void*); void threadmain(int argc, char *argv[]) { int i, j; char *s; - ulong v, vmax, nargs; + ulong nargs; char args[100]; nmach = 1; @@ -733,7 +734,7 @@ threadmain(int argc, char *argv[]) } for(i=0; i<nmach; i++) - threadcreate(machthread, &mach[i], STACK); + proccreate(machproc, &mach[i], STACK); for(i=0; i<nargs; i++) switch(args[i]){ @@ -804,10 +805,18 @@ threadmain(int argc, char *argv[]) threadcreate(keyboardthread, nil, XSTACK); threadcreate(mousethread, nil, XSTACK); threadcreate(resizethread, nil, XSTACK); - + proccreate(updateproc, nil, XSTACK); resize(); unlockdisplay(display); +} + +void +updateproc(void *z) +{ + int i; + ulong v, vmax; + USED(z); for(;;){ parity = 1-parity; lockdisplay(display); @@ -821,12 +830,12 @@ threadmain(int argc, char *argv[]) } flushimage(display, 1); unlockdisplay(display); - threadsleep(sleeptime); + sleep(sleeptime); } } void -machthread(void *v) +machproc(void *v) { char buf[256], *f[4], *p; int i, n, t; @@ -835,7 +844,7 @@ machthread(void *v) m = v; t = 0; for(;;){ - n = threadread(m->fd, buf+t, sizeof buf-t); + n = read(m->fd, buf+t, sizeof buf-t); m->dead = 0; if(n <= 0) break; |