version 1.1.2.2, 2014/01/28 12:57:52
|
version 1.2, 2014/01/28 13:17:33
|
Line 33 void *timer(sched_task_t *arg)
|
Line 33 void *timer(sched_task_t *arg)
|
|
|
void *r(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++; |
Kill++; |
taskExit(arg, NULL); |
taskExit(arg, NULL); |
} |
} |
Line 41 void *r(sched_task_t *arg)
|
Line 45 void *r(sched_task_t *arg)
|
void *w(sched_task_t *arg) |
void *w(sched_task_t *arg) |
{ |
{ |
printf("write:: test\n"); |
printf("write:: test\n"); |
write(TASK_FD(arg), "piuk\n", 6); |
|
taskExit(arg, NULL); |
taskExit(arg, NULL); |
} |
} |
|
|
Line 81 int
|
Line 84 int
|
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
sched_root_task_t *root; |
sched_root_task_t *root; |
int f, fd; | int f; |
struct sockaddr_in sin; |
struct sockaddr_in sin; |
struct timespec ts = { 20, 0 }; |
struct timespec ts = { 20, 0 }; |
// struct timespec p = { 0, 10000000 }; |
// struct timespec p = { 0, 10000000 }; |
Line 102 main(int argc, char **argv)
|
Line 105 main(int argc, char **argv)
|
if (bind(f, (struct sockaddr*) &sin, sizeof sin) == -1) |
if (bind(f, (struct sockaddr*) &sin, sizeof sin) == -1) |
return 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(); |
root = schedBegin(); |
if (!root) { |
if (!root) { |
printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); |
printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); |
Line 188 main(int argc, char **argv)
|
Line 186 main(int argc, char **argv)
|
schedRun(root, &Kill); |
schedRun(root, &Kill); |
schedEnd(&root); |
schedEnd(&root); |
|
|
close(fd); |
|
close(f); |
close(f); |
return 0; |
return 0; |
} |
} |