os_kernel_lab/labcodes_answer/lab6_result/user/yield.c

17 lines
340 B
C
Raw Normal View History

2014-08-20 15:42:20 +08:00
#include <ulib.h>
#include <stdio.h>
int
main(void) {
int i;
cprintf("Hello, I am process %d.\n", getpid());
for (i = 0; i < 5; i ++) {
yield();
cprintf("Back in process %d, iteration %d.\n", getpid(), i);
}
cprintf("All done in process %d.\n", getpid());
cprintf("yield pass.\n");
return 0;
}