--- libaitsched/example/test_brut.c 2013/08/26 15:02:59 1.1.2.2 +++ libaitsched/example/test_brut.c 2013/08/26 18:53:09 1.1.2.5 @@ -103,9 +103,18 @@ void *thr(sched_task_t *arg) { printf("tid (%lx):: %s\n", TASK_VAL(arg), __func__); printf("tid (%lu):: %s\n", TASK_VAL(arg), (char*) TASK_ARG(arg)); + fflush(stdout); taskExit(arg, 42); } +void *thrinf(sched_task_t *arg) +{ + printf("tid INF (%lu):: %s %s\n", TASK_VAL(arg), __func__, (char*) TASK_ARG(arg)); + fflush(stdout); + schedThreadSelf(arg); + taskExit(arg, 42); +} + void *thr4kill(sched_task_t *arg) { char blah[BUFSIZ]; @@ -113,7 +122,10 @@ void *thr4kill(sched_task_t *arg) printf("tid (%lx):: %s\n", TASK_VAL(arg), __func__); read(0, blah, sizeof blah); - printf("never see!!! (%lx):: %s (%d == %d)\n", TASK_VAL(arg), (char*) TASK_ARG(arg), TASK_TYPE(arg), taskTHREAD); + if (arg) + printf("never see!!! (%lx):: %s (%d == %d)\n", arg ? TASK_VAL(arg) : 0, + arg ? (char*) TASK_ARG(arg) : NULL, + arg ? TASK_TYPE(arg) : -1, taskTHREAD); taskExit(arg, 0); } @@ -227,8 +239,8 @@ main(int argc, char **argv) printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 5; } else { - ts.tv_sec = 0; - ts.tv_nsec = 1000000; + ts.tv_sec = 1; + ts.tv_nsec = 0; } if (!schedRTC(root, rtcinf, (void*) (intptr_t) ts.tv_sec, ts, (void*) 12, 0)) { @@ -283,33 +295,41 @@ main(int argc, char **argv) return 6; } - if (!(t = schedThread(root, thr4kill, "0aaaa", 0, 0, NULL, 0))) { + if (!schedThread(root, thrinf, "OHOBOHO_i_BOZA", 0, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; } - if (!schedThread(root, thr, "mdaaaa this is thread task", 0, 131072, NULL, 0)) { + if (!schedThread(root, thrinf, "OHOBOHO_i_BOZA+1", 0, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; } - if (!schedThread(root, thr, "mdaaaa this is thread task -detached", 42, 0, NULL, 0)) { + if (!(t = schedThread(root, thr4kill, "0aaaa", 0, NULL, 0))) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; } - if (!schedThread(root, thr, "mdaaaa this is thread task -j", 0, 131072, NULL, 0)) { + if (!schedThread(root, thr, "mdaaaa this is thread task", 131072, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; } + if (!schedThread(root, thr, "mdaaaa this is thread task -detached", 0, NULL, 0)) { + printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); + return 7; + } + if (!schedThread(root, thr, "mdaaaa this is thread task -j", 131072, NULL, 0)) { + printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); + return 7; + } printf("try to cancel tid = %lx\n", TASK_VAL(t)); schedCancel(t); - if (!schedThread(root, thr, "mdaaaa this is thread task -j2", 0, 131072 * 2, NULL, 0)) { + if (!schedThread(root, thr, "mdaaaa this is thread task -j2", 131072 * 2, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; } - if (!(t = schedThread(root, thr4kill, "0aaaa", 42, /*4096*/0, NULL, 0))) { + if (!(t = schedThread(root, thr4kill, "0aaaa", /*4096*/0, NULL, 0))) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; } - if (!schedThread(root, thr, "mdaaaa this is thread task -j3", 0, 0, NULL, 0)) { + if (!schedThread(root, thr, "mdaaaa this is thread task -j3", 0, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; }