--- libaitsched/example/test_time.c 2012/08/23 02:17:48 1.8.2.2 +++ libaitsched/example/test_time.c 2013/08/15 15:03:32 1.10.8.1 @@ -40,19 +40,19 @@ void *alarmz(sched_task_t *arg) void *node(sched_task_t *arg) { - printf("Node %s data %d fflags 0x%X\n", (char*) TASK_ARG(arg), TASK_RET(arg), TASK_FLAG(arg)); + printf("Node %s data %ld fflags 0x%X\n", (char*) TASK_ARG(arg), (long) TASK_RET(arg), TASK_FLAG(arg)); taskExit(arg, NULL); } void *proc(sched_task_t *arg) { - printf("Proc pid=%ld data %d fflags 0x%X\n", TASK_VAL(arg), TASK_RET(arg), TASK_FLAG(arg)); + printf("Proc pid=%ld data %ld fflags 0x%X\n", TASK_VAL(arg), (long) TASK_RET(arg), TASK_FLAG(arg)); taskExit(arg, NULL); } void *sigz(sched_task_t *arg) { - printf("Signal signal=%ld how many times %d\n", TASK_VAL(arg), TASK_RET(arg)); + printf("Signal signal=%ld how many times %ld\n", TASK_VAL(arg), (long) TASK_RET(arg)); taskExit(arg, NULL); } @@ -107,6 +107,7 @@ void *thr4kill(sched_task_t *arg) void sig(int s) { switch (s) { + case SIGINT: case SIGTERM: Kill++; break; @@ -133,6 +134,7 @@ main(int argc, char **argv) sa.sa_handler = sig; sigemptyset(&sa.sa_mask); sigaction(SIGTERM, &sa, NULL); + sigaction(SIGINT, &sa, NULL); sigaction(SIGUSR1, &sa, NULL); root = schedBegin(); @@ -234,33 +236,33 @@ main(int argc, char **argv) return 6; } - if (!(t = schedThread(root, thr4kill, "0aaaa", 0, NULL, 0))) { + if (!(t = schedThread(root, thr4kill, "0aaaa", 0, 0, NULL, 0))) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; } - if (!schedThread(root, thr, "mdaaaa this is thread task", 0, NULL, 0)) { + if (!schedThread(root, thr, "mdaaaa this is thread task", 0, 131072, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; } - if (!schedThread(root, thr, "mdaaaa this is thread task -detached", 42, NULL, 0)) { + if (!schedThread(root, thr, "mdaaaa this is thread task -detached", 42, 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, NULL, 0)) { + if (!schedThread(root, thr, "mdaaaa this is thread task -j", 0, 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, NULL, 0)) { + if (!schedThread(root, thr, "mdaaaa this is thread task -j2", 0, 131072 * 2, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; } - if (!(t = schedThread(root, thr4kill, "0aaaa", 42, NULL, 0))) { + if (!(t = schedThread(root, thr4kill, "0aaaa", 42, /*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, NULL, 0)) { + if (!schedThread(root, thr, "mdaaaa this is thread task -j3", 0, 0, NULL, 0)) { printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError()); return 7; }