changeset 1867:7706faa6b0c9 draft

resolve waitfor in fileread
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Wed, 25 Dec 2013 02:24:07 +0900
parents 7b3aa1a31c3a
children 5e06a8089625
files example/fileread/main.cc
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/example/fileread/main.cc	Wed Dec 25 02:13:28 2013 +0900
+++ b/example/fileread/main.cc	Wed Dec 25 02:24:07 2013 +0900
@@ -51,6 +51,8 @@
             read->set_param(2,(long)fr->division_size);
         }
         read->set_param(3,(long)fr->fd);  //fdの番号の受け渡し
+
+        fr->t_print->wait_for(read);
         read->spawn();
 
         fr->left_size -= fr->division_size;
@@ -59,6 +61,7 @@
 
     if (fr->left_size > 0) {
         HTaskPtr next = manager->create_task(RUN_BLOCKS, (memaddr)&fr->self, sizeof(memaddr),0,0);
+        fr->t_print->wait_for(next);
         next->wait_for(wait);
         next->spawn();
     }
@@ -164,6 +167,7 @@
 
     HTaskPtr run = NULL;
     HTaskPtr t_print = manager->create_task(Print_task, (memaddr)&fr->self, sizeof(memaddr),0,0);
+    fr->t_print = t_print;
 
     if (divide_read_flag != 0) {
         run = manager->create_task(RUN_BLOCKS, (memaddr)&fr->self, sizeof(memaddr),fr->read_text,fr->filesize);
@@ -171,6 +175,7 @@
         //my_mmap(filename, fd, fr);
         run = manager->create_task(MMAP , (memaddr)&fr->self, sizeof(memaddr),0,0);
     }
+
     t_print->wait_for(run);
     run->spawn();