/* Helper routine to perform explicit reseeds */ static void randomdev_flush_reseed(void) { /* Command a entropy queue flush and wait for it to finish */ random_kthread_control = 1; while (random_kthread_control) bsd_pause("-", hz / 10); #if defined(RANDOM_YARROW) /* This ultimately calls randomdev_unblock() */ random_yarrow_reseed(); #endif #if defined(RANDOM_FORTUNA) /* This ultimately calls randomdev_unblock() */ random_fortuna_reseed(); #endif }
int main(int argc, char **argv) { int error; mutex_lock(&test_mutex); error = kthread_add(thread_loop, NULL, NULL, &test_thread, 0, 0, "test"); if (error) { kprintf("failed to create kernel thread\n"); return 1; } mutex_unlock(&test_mutex); /* * Sleep a bit to wait for the thread to terminate. Unfortunately the * BSD kthread interface has no nice way to wait for thread termination. */ bsd_pause("kthread_test", 200); return 0; }