// function that call UtSleep
void auxFunction_for_Ex2(UT_ARGUMENT time){
	DWORD minimumTime = (DWORD)time;	// Minimum time for the thread to Sleep
	DWORD totalTimeWaiting = UtSleep(minimumTime);	// Expected return: >= 4000
	printf("\n\n -> Expected: >= %d ... Returned: %d \n", minimumTime, totalTimeWaiting);
	_ASSERTE(totalTimeWaiting >= minimumTime);
	printf("\nPress any key to continue... (%d / %d Tests passed)", currentEx2Test++, totalEx2Tests);
	getchar();
}
VOID veryUselessTimeConsumingFunction(UT_ARGUMENT millis){
	DWORD totalTimeSlept = UtSleep((DWORD)millis);
	printf("\nExpected = %d ... Returned = %d",(DWORD)millis, totalTimeSlept);
	_ASSERTE(totalTimeSlept>=(DWORD)millis);
	printf("\nPress any key to continue... (%d / %d Tests passed)", currentEx3Test++, totalEx3Tests);
	getchar();
	ex3FunctionsFinished += 1;
}
Ejemplo n.º 3
0
VOID RainParticle(UTHREAD_ARGUMENT arg) {
    int x, y;

    int deltaSleep=(rand()%10)*4;

    x= rand() % MaxX();
    y= rand() % MaxY();

    while(!stop) {
        WriteCharAt(' ', x, y);

        x = (x+ ((rand()%4)+1) ) % MaxX();
        y = (y+ ((rand()%4)+1) ) % MaxY();

        WriteCharAt('\\', x, y);
        UtSleep(20);
    }
}
Ejemplo n.º 4
0
/* determina o tempo da simulação */
VOID Stopper(UTHREAD_ARGUMENT arg) {
    UtSleep(SIMULATION_TIME);
    stop=TRUE;
}