os161/kern/test/lib.c
Scott Haseley 1b99c0e18f Refactored ksecprintf -> secprintf. Secure code is now all in common libtest161.
This library gets linked in by default in userland, and the common files are
included in the kernel.
2016-02-23 15:31:37 -05:00

29 lines
473 B
C

#include <types.h>
#include <thread.h>
#include <test.h>
#include <lib.h>
/*
* Helper functions used by testing and problem driver code
* to establish better mixtures of threads.
*/
void
random_yielder(uint32_t max_yield_count)
{
uint32_t i;
for (i = 0; i < random() % max_yield_count; i++) {
thread_yield();
}
}
void
random_spinner(uint32_t max_spin_count)
{
uint32_t i;
volatile int spin;
for (i = 0; i < random() % max_spin_count; i++) {
spin += i;
}
}