From e02b986a801307d05e238c2af42b8a56f213f6ff Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 27 Feb 2016 02:39:45 +0100 Subject: rio: exit rio when /dev/cons or /dev/kbd read loop terminates --- sys/src/cmd/rio/rio.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c index 29f5a024b..d8f7c78bf 100644 --- a/sys/src/cmd/rio/rio.c +++ b/sys/src/cmd/rio/rio.c @@ -194,6 +194,11 @@ threadmain(int argc, char *argv[]) exits("display open"); } iconinit(); + + exitchan = chancreate(sizeof(int), 0); + winclosechan = chancreate(sizeof(Window*), 0); + deletechan = chancreate(sizeof(char*), 0); + view = screen; viewr = view->r; mousectl = initmouse(nil, screen); @@ -209,10 +214,6 @@ threadmain(int argc, char *argv[]) draw(view, viewr, background, nil, ZP); flushimage(display, 1); - exitchan = chancreate(sizeof(int), 0); - winclosechan = chancreate(sizeof(Window*), 0); - deletechan = chancreate(sizeof(char*), 0); - timerinit(); threadcreate(keyboardthread, nil, STACK); threadcreate(mousethread, nil, STACK); @@ -1316,7 +1317,6 @@ kbdproc(void *arg) /* read kbd state */ while((n = read(kfd, buf, sizeof(buf))) > 0) chanprint(c, "%.*s", n, buf); - close(kfd); } else { /* read single characters */ p = buf; @@ -1337,6 +1337,7 @@ kbdproc(void *arg) p = buf + n; } } + send(exitchan, nil); } Channel* -- cgit v1.2.3