ref: e02b986a801307d05e238c2af42b8a56f213f6ff
parent: 09b250f079e38883e8ad5dc47e4aa93258e0c083
author: cinap_lenrek <[email protected]>
date: Fri Feb 26 21:39:45 EST 2016
rio: exit rio when /dev/cons or /dev/kbd read loop terminates
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -194,6 +194,11 @@
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 @@
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 @@
/* 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 @@
p = buf + n;
}
}
+ send(exitchan, nil);
}
Channel*