void EX1_TEST() {
	UtInit();
	_tprintf(_T("\n :::  *** -- Starting EXERCICIO 1 (UtJoin function) TEST -- ***  ::: \n"));
	UtCreate(auxFunction_for_Ex1, NULL);
	testerHandle = UtCreate(uselessFunction, (UT_ARGUMENT)5);
	UtRun();
	_tprintf(_T("\n\n :::  *** -- EXERCICIO 1 - TEST COMPLETED -- ***  ::: \n"));
	UtEnd();
}
Esempio n. 2
0
int main () {
    UtInit();

    Test1();
    getchar();


    UtEnd();
    return 0;
}
Esempio n. 3
0
/* Original main */
int main1 () {
	UtInit();
 
	Test1();

	printf("Press any key to finish");
	getchar();
		 
	UtEnd();
	return 0;
}
Esempio n. 4
0
VOID Test1 ()  {
    ULONG Index;
    Test1_Count = 0;

    printf("\n :: Test 1 - BEGIN :: \n\n");


    for (Index = 0; Index < MAX_THREADS; ++Index) {
        UtCreate(Test1_Thread, (UT_ARGUMENT)('0' + Index), 16 * 4096 , _T("ThreadName"));
    }
    UtDump(STACK_SIZE);
    UtRun();
    UtDump(STACK_SIZE);
    _ASSERTE(Test1_Count == MAX_THREADS);
    UtEnd();
    printf("\n\n :: Test 1 - END :: \n");
}
Esempio n. 5
0
static VOID ClientServerMsg() {
	LONG vals[] = {1,2,3,4,5,6};
	CLIENT_ARGS cargs;

	cargs.numbers = vals;
	cargs.totalNumbers = sizeof(vals)/sizeof(LONG);
 		
	InitializeListHead(&QMSG);

	UtInit();
	ClientId = UtCreate(Client, (UT_ARGUMENT) &cargs,16*4096,NULL);
	ServerId = UtCreate(Server, NULL, 16*4096,NULL);

	UtRun();

	UtEnd();

	printf("ClientServerMsg Test Done!\n");
}
Esempio n. 6
0
int main(){
	UtInit();

	//JoinTest();		/* Ex1_Test */
	//SleepTest();	/* Ex2_Test */

	/*
	Escreva programas para determinar o tempo de comutação de threads na biblioteca UThread. Para                            
	a medição de tempos, utilize a função da Windows API GetTickCount.
	*/
	SwitchTest();	/* Ex3_Test */

	UtRun();

	printf("\nPress any key to finish");
	getchar();

	UtEnd();
	return 0;
}
int main(int argc, const char * argv[]) {

	if (argc != 3) {
		fprintf(stderr, "use: %s input_file filter_char\n", argv[0]);
		exit(1);
	}

	UtInit();

	Prepare();

	UtCreate(ReaderThread, (UT_ARGUMENT)argv[1]);
	UtCreate(FilterThread, (UT_ARGUMENT)argv[2][0]);
	UtCreate(PrinterThread, (UT_ARGUMENT)0);
	
	UtRun();
	
	UtEnd();
	return 0;
}
Esempio n. 8
0
int main(int argc, char* argv[])
{
    int i;

    InitConsole();
    ClearScreen(BACKGROUND_GRAY, BLACK);

    UtInit();

    UtCreate(Stopper, (UTHREAD_ARGUMENT) SIMULATION_TIME);
    for (i=0; i < PARTICLES_NUMBER; ++i )
        UtCreate(RainParticle, NULL);

    UtRun();

    UtEnd();

    ClearScreen(BACKGROUND_WHITE, BLACK);
    printf("End of Simulation!\n");
    return 0;
}
void EX2_TEST() {
	totalEx2Tests = 4, currentEx2Test = 1;
	UtInit();
	_tprintf(_T("\n :::  *** -- Starting EXERCICIO 2 (UtSleep function) TEST -- ***  ::: \n"));

	// Wait more than 0 milliseconds
	UtCreate(auxFunction_for_Ex2, (UT_ARGUMENT)0);

	// Wait more than 2000 milliseconds
	UtCreate(auxFunction_for_Ex2, (UT_ARGUMENT)2000);

	// Wait more than 10000 milliseconds
	UtCreate(auxFunction_for_Ex2, (UT_ARGUMENT)10000);

	// Wait more than 13000 milliseconds
	UtCreate(auxFunction_for_Ex2, (UT_ARGUMENT)13000);

	UtRun();
	_tprintf(_T("\n\n :::  *** -- EXERCICIO 2 - TEST COMPLETED -- ***  ::: \n"));
	UtEnd();
}
void EX3_TEST() {
	UtInit();
	_tprintf(_T("\n :::  *** -- Starting EXERCICIO 3 (CONTEXT SWITCH TIME) TEST -- ***  ::: \n"));

	totalEx3Tests = 5; currentEx3Test = 1; ex3FunctionsFinished = 0;
	test3MustEnd = FALSE;

	// Create the thread that will wake the others in case they are ALL sleeping
	UtCreate(auxFunctionThatYields, (UT_ARGUMENT)NULL);

	UtCreate((UT_FUNCTION)veryUselessTimeConsumingFunction, (UT_ARGUMENT)1000);		//1 s
	UtCreate((UT_FUNCTION)veryUselessTimeConsumingFunction, (UT_ARGUMENT)2000);		//2 s
	UtCreate((UT_FUNCTION)veryUselessTimeConsumingFunction, (UT_ARGUMENT)5000);		//5 s
	UtCreate((UT_FUNCTION)veryUselessTimeConsumingFunction, (UT_ARGUMENT)10000);	//10 s
	UtCreate((UT_FUNCTION)veryUselessTimeConsumingFunction, (UT_ARGUMENT)12000);	//12 s

	UtRun();
	
	_tprintf(_T("\n\n :::  *** -- EXERCICIO 3 - TEST COMPLETED -- ***  ::: \n"));
	UtEnd();
}
Esempio n. 11
0
DWORD _tmain( DWORD argc, PTCHAR argv[] ) {
	long numbers[MAX_WORK] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
	UtInit();

	utClient = UtCreate(Client, numbers);
	utServer = UtCreate(Server, numbers);
	
	UtRun();

	UtEnd();

	printf("factoriais:\n\t");
	for (int i = 0; i < MAX_WORK; i++)
		printf("%d ", numbers[i]);

	putchar('\n');

	printf("Press enter key to finish...\n");
	getchar();

	return 0;
}