45,6 → 45,7 |
static atomic_t threads_ok; |
static atomic_t threads_fault; |
static waitq_t can_start; |
static bool sh_quiet; |
|
static void testit1(void *data) |
{ |
70,7 → 71,8 |
); |
|
if (arg != after_arg) { |
printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
if (!sh_quiet) |
printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
atomic_inc(&threads_fault); |
break; |
} |
101,7 → 103,8 |
); |
|
if (arg != after_arg) { |
printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
if (!sh_quiet) |
printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
atomic_inc(&threads_fault); |
break; |
} |
113,17 → 116,21 |
char * test_mips2(bool quiet) |
{ |
unsigned int i, total = 0; |
sh_quiet = quiet; |
|
waitq_initialize(&can_start); |
atomic_set(&threads_ok, 0); |
atomic_set(&threads_fault, 0); |
printf("Creating %d threads... ", 2 * THREADS); |
|
if (!quiet) |
printf("Creating %d threads... ", 2 * THREADS); |
|
for (i = 0; i < THREADS; i++) { |
thread_t *t; |
|
if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) { |
printf("could not create thread %d\n", 2 * i); |
if (!quiet) |
printf("could not create thread %d\n", 2 * i); |
break; |
} |
thread_ready(t); |
130,19 → 137,23 |
total++; |
|
if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) { |
printf("could not create thread %d\n", 2 * i + 1); |
if (!quiet) |
printf("could not create thread %d\n", 2 * i + 1); |
break; |
} |
thread_ready(t); |
total++; |
} |
printf("ok\n"); |
|
if (!quiet) |
printf("ok\n"); |
|
thread_sleep(1); |
waitq_wakeup(&can_start, WAKEUP_ALL); |
|
while (atomic_get(&threads_ok) != total) { |
printf("Threads left: %d\n", total - atomic_get(&threads_ok)); |
if (!quiet) |
printf("Threads left: %d\n", total - atomic_get(&threads_ok)); |
thread_sleep(1); |
} |
|