static void doPotato(int mySlot)//You will want to create data structures like a ready list (for TCBs that are { int ret; int moved; int passes = 0; printf("Made it to doPotato %d\n", mySlot); while(1){ assert(alarmIsEnabled()); moved = tryMovePotato(mySlot); if(moved){ passes++; printf("%d passes potato for %d-st/nd/rd time \n", mySlot, passes); } /* * Add some yields by some threads to scramble the list */ if(mySlot > 4){ int ii; for(ii = 0; ii < mySlot - 4; ii++){ ret = ULT_Yield(ULT_ANY); assert(ULT_isOKRet(ret)); } } } }
static void doPotato(int mySlot) { int ret; int moved; int passes = 0; printf("Made it to doPotato %d\n", mySlot); while(1){ assert(alarmIsEnabled()); moved = tryMovePotato(mySlot); if(moved){ passes++; printf("%d passes potato for %d-st/nd/rd time \n", mySlot, passes); } /* * Add some yields by some threads to scramble the list */ if(mySlot > 4){ int ii; for(ii = 0; ii < mySlot - 4; ii++){ ret = ULT_Yield(ULT_ANY); assert(tidValid(ret)); } } } }