/*! initialize thread structures and create idle thread */
void k_threads_init ()
{
	extern kdevice_t *u_stdin, *u_stdout;
	kthread_t *kthr;
	int prio;

	list_init ( &all_threads );

	/* queue for ready threads is empty */
	init_ready_list ();

	/* setup programs */
	pi.stdin = u_stdin;
	pi.stdout = u_stdout;

	pi.heap = kmalloc ( PROG_HEAP_SIZE );
	pi.heap_size = PROG_HEAP_SIZE;

	prio = pi.prio;
	if ( !prio )
		prio = THR_DEFAULT_PRIO;

	/* idle thread */
	kthr = k_create_thread ( idle_thread, NULL, NULL, 0, NULL, 0, 1 );

	/* first "user" thread */
	k_create_thread (pi.init, NULL, pi.exit, prio, NULL, 0, 1 );

	active_thread = NULL;

	k_schedule_threads ();
}
Beispiel #2
0
/*! initialize thread structures and create idle thread */
void k_threads_init ()
{
	kthread_t *kthr;

	list_init ( &all_threads );
	list_init ( &procs );

	/* queue for ready threads is empty */
	init_ready_list ();

	/* initially create 'idle thread' */
	kernel_proc.prog = NULL;
	kernel_proc.stack_pool = NULL;
	kernel_proc.m.start = NULL;
	kernel_proc.m.size = (size_t) 0xffffffff;

	kthr = k_create_thread ( idle_thread, NULL, NULL, 0, NULL, 0, 1,
				&kernel_proc );

	active_thread = NULL;

	k_schedule_threads ();
}