Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3068 → Rev 3069

/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%u, tid %" PRIu64 ": 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%u, tid %" PRIu64 ": success\n", CPU->id, THREAD->tid);
printf("cpu%u, tid %" PRIu64 ": 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%u, tid %" PRIu64 ": success\n", CPU->id, THREAD->tid);
atomic_dec(&thread_count);
}
88,7 → 88,7
while (atomic_get(&thread_count) > 0) {
if (!quiet)
printf("Threads left: %d\n", atomic_get(&thread_count));
printf("Threads left: %ld\n", atomic_get(&thread_count));
thread_sleep(1);
}
/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%u, tid %" PRIu64 " 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%u, tid %" PRIu64 " 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%u, tid %" PRIu64 " 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%u, tid %" PRIu64 " 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%u, tid %" PRIu64 " 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%u, tid %" PRIu64 " 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%u, tid %" PRIu64 " 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%u, tid %" PRIu64 " r-\n", CPU->id, THREAD->tid);
atomic_dec(&thread_count);
}
 
159,8 → 159,8
context_save(&ctx);
if (!quiet) {
printf("sp=%#x, readers_in=%d\n", ctx.sp, rwlock.readers_in);
printf("Creating %d readers\n", rd);
printf("sp=%#x, readers_in=%" PRIc "\n", ctx.sp, rwlock.readers_in);
printf("Creating %" PRIu32 " readers\n", rd);
}
for (i = 0; i < rd; i++) {
168,11 → 168,11
if (thrd)
thread_ready(thrd);
else if (!quiet)
printf("Could not create reader %d\n", i);
printf("Could not create reader %" PRIu32 "\n", i);
}
 
if (!quiet)
printf("Creating %d writers\n", wr);
printf("Creating %" PRIu32 " writers\n", wr);
for (i = 0; i < wr; i++) {
thrd = thread_create(writer, NULL, TASK, 0, "writer", false);
179,7 → 179,7
if (thrd)
thread_ready(thrd);
else if (!quiet)
printf("Could not create writer %d\n", i);
printf("Could not create writer %" PRIu32 "\n", i);
}
thread_usleep(20000);
187,7 → 187,7
while (atomic_get(&thread_count) > 0) {
if (!quiet)
printf("Threads left: %d\n", atomic_get(&thread_count));
printf("Threads left: %ld\n", atomic_get(&thread_count));
thread_sleep(1);
}
/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%u, tid %" PRIu64 " 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%u, tid %" PRIu64 " down!\n", CPU->id, THREAD->tid);
return;
}
printf("cpu%d, tid %llu down=\n", CPU->id, THREAD->tid);
printf("cpu%u, tid %" PRIu64 " 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%u, tid %" PRIu64 " up\n", CPU->id, THREAD->tid);
}
 
char * test_semaphore2(bool quiet)
91,7 → 91,7
thread_t *thrd;
k = random(7) + 1;
printf("Creating %d consumers\n", k);
printf("Creating %" PRIu32 " consumers\n", k);
for (i = 0; i < k; i++) {
thrd = thread_create(consumer, NULL, TASK, 0, "consumer", false);
if (thrd)
/trunk/kernel/test/synch/rwlock5.c
108,7 → 108,7
waitq_wakeup(&can_start, WAKEUP_ALL);
while ((items_read.count != readers) || (items_written.count != writers)) {
printf("%zd readers remaining, %zd writers remaining, readers_in=%zd\n", readers - items_read.count, writers - items_written.count, rwlock.readers_in);
printf("%d readers remaining, %d writers remaining, readers_in=%d\n", readers - items_read.count, writers - items_written.count, rwlock.readers_in);
thread_usleep(100000);
}
}