Exemple #1
0
void
start(void)
{
	int i;
	
	sys_set_priority(__PRIORITY__);
	sys_set_share(__SHARE__);
	sys_set_lottery_tickets(__LOTTERY_TICKETS__);

	for (i = 0; i < RUNCOUNT; i++) {
		// Write characters to the console, yielding after each one.

		#ifdef __PRINT_METHOD_LOCK__

		while(atomic_swap(&lock, 1) != 0) 
			continue;
		*cursorpos++ = PRINTCHAR;
		atomic_swap(&lock, 0);
		
		#else
		
		sys_atomic_print(PRINTCHAR);

		#endif

		sys_yield();
	}

	// Yield forever.
	//while (1)
	//	sys_yield();
	sys_exit(0);
}
Exemple #2
0
void
start(void)
{
	int i;

	for (i = 0; i < RUNCOUNT; i++) {
		// Write characters to the console, yielding after each one.
		if (i == 100) {
		    sys_renice(NICE_VALUE);
		    sys_set_share(SHARE_VALUE);
		}
		sys_atomic_printc(PRINTCHAR);
		// *cursorpos++ = PRINTCHAR;
		sys_yield();
	}

	sys_exit(0);
}