コード例 #1
0
int main (int argc, char* argv[])
{
	//create an array of processes called queue.
	ticks = 0;
	loop = 0;
	queue q;
	createQueue(q);
	while (loop == 0)
	{
		ticks++;
		printf("%d",ticks);
		int i;
		for (i = 1; i < getQueueSize(q); i++)
		{
			if (ticks - q.items[i].timeStamp > ticks)
			{
				if (getQueueSize(q) > 0)
				{
					scheduleProcess(q);
				}
			}	
		}
		getUserInput(q);
		if (ticks % 10 == 0)
		{
			for (i = 1; i < getQueueSize(q); i++)
			{
				q.items[i].priority = q.items[i].priority + 1;
			}			
		}
		
	}
}
コード例 #2
0
bool MainScene::init() {
	if (!Layer::init())
		return false;

	size = Director::getInstance()->getVisibleSize();

	createBackground();
	createCloud();
	createMouse();
	createProp();
	createCucrbit();
	createWeather();
	eventProcess();
	initCucurbit();
	createProgress();
	createProgressBlood();

	LoadingScene::loadData();

	if (hudLayer != nullptr)
		hudLayer->updateIQ();

	scheduleProcess();

	isHold = false;
	isFall = false;
	isAction = false;
	isJump = false;
	isSkateboardHit = false;
	isSkateboardFinishAction = false;
	isSkateboard = false;
	isSholvePropChose = false;
	mouseFallingSnare = nullptr;
	skateboard = nullptr;
	snares.clear();

	return true;
}
コード例 #3
0
ファイル: ProcessScheduling.c プロジェクト: xXFracXx/MIT-Labs
int main (int argc, const char * argv []) {

    MQUEUE_p_t *front = (MQUEUE_p_t *)malloc(MAX * sizeof(MQUEUE_p_t));
    MQUEUE_p_t *rear = (MQUEUE_p_t *)malloc(MAX * sizeof(MQUEUE_p_t));

    initQueue(front, rear);

    inputProcess(front, rear, 11, 1, 10);
    inputProcess(front, rear, 12, 1, 10);
    inputProcess(front, rear, 13, 1, 10);

    inputProcess(front, rear, 21, 2, 20);
    inputProcess(front, rear, 22, 2, 20);
    inputProcess(front, rear, 23, 2, 20);
    inputProcess(front, rear, 24, 2, 20);
    inputProcess(front, rear, 25, 2, 20);

    inputProcess(front, rear, 31, 3, 30);
    inputProcess(front, rear, 32, 3, 30);

    scheduleProcess(front);

}