view example/regex_mas/ppe/Read.cc @ 1863:3f058fee44d2 draft

fix read_run16 loops ( cannot running )
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Tue, 24 Dec 2013 17:56:24 +0900
parents 64c571a30bdb
children 08e9e416c2e0
line wrap: on
line source

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <iostream>
#include <vector>
#include <cstdlib>

#include "SchedTask.h"
#include "Print.h"
#include "Func.h"

/* これは必須 */
SchedDefineTask1(Task_read,task_read);

static int
task_read(SchedTask *s, void *rbuf, void *wbuf)
{
    long task_number = (long)s->get_param(0);   //何番目のtaskか
    long division_size = (long)s->get_param(1);
    long read_size = (long)s->get_param(2);
    long fd = (long)s->get_param(3);    //fdの番号の受け取り

    char *readtext = (char*)s->get_output(wbuf,0);

    //char *text = (char*)s->allocate(sizeof(char)*read_size + 1);
    //char text[(long)read_size];
    //text[(long)read_size] = '\0';
    //s->printf("[read No: %lld]\n",task_number+1);

    pread(fd, readtext, read_size , division_size*task_number);

    //readtext = text;

    return 0;
}