示例#1
0
文件: Platform.c 项目: ATLTed/wonder
void WA_yield()
{
   cthread_yield(cthread_self());
}
示例#2
0
int 
ldap_pvt_thread_yield( void )
{
	cthread_yield();
	return 0;
}
示例#3
0
/*
 * Initialize and Run the default pager
 */
void
default_pager(void)
{
	int			i, id;
	static char		here[] = "default_pager";
	mach_msg_options_t 	server_options;
	default_pager_thread_t	dpt;
	default_pager_thread_t	**dpt_array;

	default_pager_thread_privileges();

	/*
	 * Wire down code, data, stack
	 */
	wire_all_memory();

	/*
	 * Give me space for the thread array and zero it.
	 */
	i = default_pager_internal_count + default_pager_external_count + 1;
	dpt_array = (default_pager_thread_t **)
	    kalloc(i * sizeof(default_pager_thread_t *));
	memset(dpt_array, 0, i * sizeof(default_pager_thread_t *));

	/* Setup my thread structure.  */
	id = 0;
	dpt.dpt_thread = cthread_self();
	dpt.dpt_buffer = 0;
	dpt.dpt_internal = FALSE;
	dpt.dpt_id = id++;
	dpt.dpt_initialized_p = TRUE;
	cthread_set_data(cthread_self(), (char *) &dpt);
	dpt_array[0] = &dpt;

	/*
	 * Now we create the threads that will actually
	 * manage objects.
	 */

	for (i = 0; i < default_pager_internal_count; i++) {
		dpt_array[id] = start_default_pager_thread(id, TRUE);
		id++;
	 }

	for (i = 0; i < default_pager_external_count; i++) {
		dpt_array[id] = start_default_pager_thread(id, FALSE);
		id++;
	}

	/* Is everybody ready?  */
	for (i = 0; i < id; i++)
	    while (!dpt_array[i])
		cthread_yield();

	/* Tell the bootstrap process to go ahead.  */
	bootstrap_completed(bootstrap_port, mach_task_self());

	/* Start servicing requests.  */
	server_options = MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SEQNO);
	for (;;) {
		mach_msg_server(default_pager_demux_default,
				default_pager_msg_size,
				default_pager_default_set,
				server_options);
		Panic("default server");
	}
}