--- libaitsched/example/test_basic.c 2014/01/28 12:57:52 1.1.2.2 +++ libaitsched/example/test_basic.c 2014/01/28 13:10:08 1.1.2.3 @@ -33,7 +33,11 @@ void *timer(sched_task_t *arg) void *r(sched_task_t *arg) { - printf("read:: %ld bytes wait\n", (long) TASK_RET(arg)); + int rlen; + char buf[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; + + rlen = read(TASK_FD(arg), buf, sizeof buf); + printf("read:: %d bytes readed = %s\n", rlen, buf); Kill++; taskExit(arg, NULL); } @@ -41,7 +45,6 @@ void *r(sched_task_t *arg) void *w(sched_task_t *arg) { printf("write:: test\n"); - write(TASK_FD(arg), "piuk\n", 6); taskExit(arg, NULL); } @@ -81,7 +84,7 @@ int main(int argc, char **argv) { sched_root_task_t *root; - int f, fd; + int f; struct sockaddr_in sin; struct timespec ts = { 20, 0 }; // struct timespec p = { 0, 10000000 }; @@ -102,11 +105,6 @@ main(int argc, char **argv) if (bind(f, (struct sockaddr*) &sin, sizeof sin) == -1) return 1; - fd = open("test_aio.dat", O_CREAT | O_RDWR, 0644); - if (fd == -1) - return 1; - printf("fd=%d\n", fd); - root = schedBegin(); if (!root) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); @@ -188,7 +186,6 @@ main(int argc, char **argv) schedRun(root, &Kill); schedEnd(&root); - close(fd); close(f); return 0; }