/trunk/kernel/test/synch/rwlock3.c |
---|
45,14 → 45,14 |
thread_detach(THREAD); |
if (!sh_quiet) |
printf("cpu%d, tid %llu: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid); |
rwlock_read_lock(&rwlock); |
rwlock_read_unlock(&rwlock); |
if (!sh_quiet) { |
printf("cpu%d, tid %llu: success\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %llu: trying to lock rwlock for writing....\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d: success\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d: trying to lock rwlock for writing....\n", CPU->id, THREAD->tid); |
} |
rwlock_write_lock(&rwlock); |
59,7 → 59,7 |
rwlock_write_unlock(&rwlock); |
if (!sh_quiet) |
printf("cpu%d, tid %llu: success\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d: success\n", CPU->id, THREAD->tid); |
atomic_dec(&thread_count); |
} |
/trunk/kernel/test/synch/rwlock4.c |
---|
74,18 → 74,18 |
to = random(40000); |
if (!sh_quiet) |
printf("cpu%d, tid %llu w+ (%d)\n", CPU->id, THREAD->tid, to); |
printf("cpu%d, tid %d w+ (%d)\n", CPU->id, THREAD->tid, to); |
rc = rwlock_write_lock_timeout(&rwlock, to); |
if (SYNCH_FAILED(rc)) { |
if (!sh_quiet) |
printf("cpu%d, tid %llu w!\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d w!\n", CPU->id, THREAD->tid); |
atomic_dec(&thread_count); |
return; |
} |
if (!sh_quiet) |
printf("cpu%d, tid %llu w=\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d w=\n", CPU->id, THREAD->tid); |
if (rwlock.readers_in) { |
if (!sh_quiet) |
106,7 → 106,7 |
rwlock_write_unlock(&rwlock); |
if (!sh_quiet) |
printf("cpu%d, tid %llu w-\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d w-\n", CPU->id, THREAD->tid); |
atomic_dec(&thread_count); |
} |
119,24 → 119,24 |
to = random(2000); |
if (!sh_quiet) |
printf("cpu%d, tid %llu r+ (%d)\n", CPU->id, THREAD->tid, to); |
printf("cpu%d, tid %d r+ (%d)\n", CPU->id, THREAD->tid, to); |
rc = rwlock_read_lock_timeout(&rwlock, to); |
if (SYNCH_FAILED(rc)) { |
if (!sh_quiet) |
printf("cpu%d, tid %llu r!\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d r!\n", CPU->id, THREAD->tid); |
atomic_dec(&thread_count); |
return; |
} |
if (!sh_quiet) |
printf("cpu%d, tid %llu r=\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d r=\n", CPU->id, THREAD->tid); |
thread_usleep(30000); |
rwlock_read_unlock(&rwlock); |
if (!sh_quiet) |
printf("cpu%d, tid %llu r-\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d r-\n", CPU->id, THREAD->tid); |
atomic_dec(&thread_count); |
} |
/trunk/kernel/test/synch/semaphore2.c |
---|
67,18 → 67,18 |
waitq_sleep(&can_start); |
to = random(20000); |
printf("cpu%d, tid %llu down+ (%d)\n", CPU->id, THREAD->tid, to); |
printf("cpu%d, tid %d down+ (%d)\n", CPU->id, THREAD->tid, to); |
rc = semaphore_down_timeout(&sem, to); |
if (SYNCH_FAILED(rc)) { |
printf("cpu%d, tid %llu down!\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d down!\n", CPU->id, THREAD->tid); |
return; |
} |
printf("cpu%d, tid %llu down=\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d down=\n", CPU->id, THREAD->tid); |
thread_usleep(random(30000)); |
semaphore_up(&sem); |
printf("cpu%d, tid %llu up\n", CPU->id, THREAD->tid); |
printf("cpu%d, tid %d up\n", CPU->id, THREAD->tid); |
} |
char * test_semaphore2(bool quiet) |