changeset 177:d4e068b15f30

tweak
author anatofuz
date Fri, 17 Jan 2020 15:09:01 +0900
parents da4c83ae7ada
children 0ef5c1d852fe
files src/CMakeLists.txt src/impl/file_impl_pipe.cbc
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/CMakeLists.txt	Fri Jan 17 15:02:42 2020 +0900
+++ b/src/CMakeLists.txt	Fri Jan 17 15:09:01 2020 +0900
@@ -126,7 +126,7 @@
   SOURCES
 	string.c arm.c asm.S bio.c buddy.c console.cbc exec.c file.cbc fs.c log.c main.c memide.c pipe.cbc proc.cbc spinlock.cbc 
 	start.c swtch.S syscall.cbc sysfile.cbc sysproc.c trap_asm.S trap.c vm.c device/picirq.c device/timer.c device/uart.c 
-  SingleLinkedStack.cbc 
+  SingleLinkedStack.cbc  impl/file_impl_pipe.cbc
          entry.S 
 )
 
--- a/src/impl/file_impl_pipe.cbc	Fri Jan 17 15:02:42 2020 +0900
+++ b/src/impl/file_impl_pipe.cbc	Fri Jan 17 15:09:01 2020 +0900
@@ -46,14 +46,18 @@
 
 __code piperead1(struct pipe* p, char* addr, int n, __code next(...)) {
     if (p->nread == p->nwrite && p->writeopen){
-        if(proc->killed){
-            release(&p->lock);
-            goto cbc_context->error();
-        }
-        goto cbc_sleep(p,&p->nread, &p->lock, next,cbc_piperead1);
+        goto cbc_piperead2(p,addr,n,next);
     }
     n = 0;
-    goto cbc_piperead2(p,n);
+    goto cbc_piperead3(p,addr,n,next);
+}
+
+__code piperead2(struct pipe* p, char* addr, int n, __code next(...)) {
+    if(proc->killed){
+        release(&p->lock);
+        goto cbc_context->error();
+    }
+    goto cbc_sleep(p,&p->nread, &p->lock, next,cbc_piperead1);
 }
 
 __code cbc_sleep(struct pipe* p, unit* nread, struct spinlock* lock, __code next(...), __code pread(...)){