changeset 351:1fb6c09db515

add cbc_consoleread2
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Mon, 02 Mar 2020 18:16:50 +0900
parents 26ab43de3654
children 582f538160d8
files src/impl/ConsoleIO.cbc
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/ConsoleIO.cbc	Mon Mar 02 16:17:24 2020 +0900
+++ b/src/impl/ConsoleIO.cbc	Mon Mar 02 18:16:50 2020 +0900
@@ -80,8 +80,15 @@
 }
 
 __code consoleread2(struct ConsoleIO* IO, struct inode*  ip, __code next(...)) {
-
-    goto next(...);
+    if (input.r == input.w) { // input is global variable
+        if (proc->killed) {
+            release(&input.lock);
+            ilock(ip);
+            goto next(-1);
+        }
+       goto cbc_sleep(&input.r, &input.lock, cbc_consoleread2);
+    }
+    goto IO->consoleread1();
 }