--- libaitsched/example/test_basic.c 2014/01/28 13:17:33 1.2 +++ libaitsched/example/test_basic.c 2014/05/21 22:03:08 1.3.4.2 @@ -8,7 +8,6 @@ #include #include #include -#include "../inc/config.h" #include intptr_t Kill; @@ -37,14 +36,17 @@ void *r(sched_task_t *arg) char buf[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; rlen = read(TASK_FD(arg), buf, sizeof buf); - printf("read:: %d bytes readed = %s\n", rlen, buf); + printf("read:: RET=%d FLAG=0x%lx rlen=%d bytes readed = %s\n", + (int) TASK_RET(arg), TASK_FLAG(arg), (int) rlen, buf); + for (rlen = 0; rlen < TASK_RET(arg); rlen++) + printf("buf[%d]=%c\n", rlen, buf[rlen]); Kill++; taskExit(arg, NULL); } void *w(sched_task_t *arg) { - printf("write:: test\n"); + printf("write:: RET=%d FLAG=0x%lx\n", (int) TASK_RET(arg), TASK_FLAG(arg)); taskExit(arg, NULL); } @@ -98,7 +100,9 @@ main(int argc, char **argv) f = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (f == -1) return 1; +#ifndef __linux__ sin.sin_len = sizeof sin; +#endif sin.sin_family = AF_INET; sin.sin_port = htons(2345); sin.sin_addr.s_addr = INADDR_ANY; @@ -153,7 +157,7 @@ main(int argc, char **argv) } if (!schedThread(root, thr, "mdaaaa this is thread task", 8192, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); - return 7; + printf("stack is too small\n"); } if (!schedThread(root, thr, "mdaaaa this is thread task -detached", 131072, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); @@ -175,7 +179,7 @@ main(int argc, char **argv) } if (!schedThread(root, thr, "mdaaaa this is thread task -j3", 4096, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); - return 7; + printf("stack is too small\n"); } sleep(1); schedCancel(t);