int main() { char c1 = 'a'; char c2 = 'b'; char c3 = 'c'; char c4 = 'd'; int j; int tid1; int tid2; int tid3; int tid4; tid1 = UserThreadCreate(SimpleThread, (void*) &c1); tid2 = UserThreadCreate(SimpleThread, (void*) &c2); tid3 = UserThreadCreate(SimpleThread, (void*) &c3); tid4 = UserThreadCreate(SimpleThread, (void*) &c4); for (j = 0; j < 10; j++) { PutChar('m'); PutInt(j); PutChar('\n'); } UserThreadJoin(tid1); UserThreadJoin(tid2); UserThreadJoin(tid3); UserThreadJoin(tid4); /* not reached */ return 0; }
int main() { int thread_id; PutString("Je lance le Thread 1\n"); thread_id = UserThreadCreate(print, (void *)1); if (thread_id > 0) { UserThreadJoin(thread_id); } else { PutString("Erreur UserThreadCreate\n"); } PutString("Fin Thread 1\n"); PutString("Je lance le Thread 2\n"); thread_id = UserThreadCreate(print, (void *)2); if (thread_id > 0) { UserThreadJoin(thread_id); } else { PutString("Erreur UserThreadCreate\n"); } PutString("Fin Thread 2\n"); PutString("Je lance le Thread 3\n"); thread_id = UserThreadCreate(print, (void *)3); if (thread_id > 0) { UserThreadJoin(thread_id); } else { PutString("Erreur UserThreadCreate\n"); } PutString("Fin du main : \n"); return 0; }
int main() { //PutString("Début du main...\n"); UserThreadCreate(print,(void *) 12); UserThreadCreate(print,(void *) 23 ); PutString("coucou2"); return 0 ; }
int main() { sem_t sem; struct s a, b, c, d; int tid1; int tid2; int tid3; int tid4; sem = sem_create("usersem test", 1); a.sem = &sem; a.c = 'a'; b.sem = &sem; b.c = 'b'; c.sem = &sem; c.c = 'c'; d.sem = &sem; d.c = 'd'; tid1 = UserThreadCreate(SimpleThread, (void*) &a); tid2 = UserThreadCreate(SimpleThread, (void*) &b); tid3 = UserThreadCreate(SimpleThread, (void*) &c); tid4 = UserThreadCreate(SimpleThread, (void*) &d); UserThreadJoin(tid1); UserThreadJoin(tid2); UserThreadJoin(tid3); UserThreadJoin(tid4); sem_destroy(sem); return 0; }
int main(int argc, char *argv[]) { userthread_id ut_id; UserThreadInit(); UserThreadCreate(&ut_id, ThreadFunc, "I am thread 1"); UserThreadCreate(&ut_id, ThreadFunc, "I am thread 2"); Loop(); return 0; }
int main(){ void * arg[2]; char * arg2; arg[0]=(void *)"thread"; arg[1]=(void *)1; arg2="thread2"; UserThreadCreate(function1,arg); UserThreadCreate(function2,(void *)arg2); Exit(0); }
int main(int argc, char** argv) { int i = 7; int tid = UserThreadCreate(Thread, &i); UserThreadJoin(tid); i = 7; tid = UserThreadCreate(Thread, &i); UserThreadJoin(tid); return 0; }
int main(){ int t1, t2; t1 = UserThreadCreate(print,(void *) 'a'); t2 = UserThreadCreate(print,(void *) 'e'); UserThreadJoin(t1); UserThreadJoin(t2); PutChar('\n'); return 0; }
int main() { PutString("\n-----------------------------------------\n"); PutString("Lancement du test threadMulti : \n"); PutString("Lance 2 threads executant la meme fonction.\n"); PutString("Doit afficher des 5 et des 6\".\n"); PutString("-----------------------------------------\n"); int a = 5; int b = 6; UserThreadCreate(f, &a); UserThreadCreate(f, &b); return 0; }
int main() { PutString("\n-----------------------------------------\n"); PutString("Lancement du test testFin : \n"); PutString("Teste la terminaison des threads sans appel explicite a UserThreadExit.\n"); PutString("-----------------------------------------\n"); PutString("Main, Tid : \n"); PutInt(GetTid()); PutString("\n"); UserThreadCreate(f, 0); UserThreadCreate(g, 0); UserThreadCreate(fin, 0); return 0; }
int main() { PutString("\n-----------------------------------------\n"); PutString("Lancement du test threadMulJoin : \n"); PutString("Test le Join multiple sur le meme thread.\n"); PutString("Doit afficher \"Erreur join ...\".\n"); PutString("-----------------------------------------\n"); int tidf, tidg; tidg = UserThreadCreate(g, 0); tidf = UserThreadCreate(f, &tidg); if(UserThreadJoin(tidg, 0) == -1) PutString("Erreur join du main sur g\n"); PutString("Fin du main\n"); return 0; }
int main(){ int t1, t2; t1 = UserThreadCreate(print,(void *) 7); t2 = UserThreadCreate(print,(void *) 8); UserThreadJoin(t2); SynchPutString("Je suis le thread principal"); //char a = SynchGetChar(); return 0; }
int main() { UserThreadCreate(f, (void *) THIS); f((void*) THAT); return 0; }
int main() { int id[THREAD_NUMBER]; int i; // Call init explicitly to avoid semaphore creation problem in cast of // concurrency memory_init(); for (i = 0; i < THREAD_NUMBER; i++) { id[i] = UserThreadCreate(&fn, NULL); if (id[i] < 0) { PutString("Thread creation failed !\n"); return -1; } } for (i = 0; i < THREAD_NUMBER; i++) { if (UserThreadJoin(id[i], NULL) != 0) { PutString("Error while joining\n"); return -1; } } if (!not_all_freed()) PutString("ok"); return 0; }
int main() { int id[NB_THREADS]; int i; for(i=0;i<NB_THREADS;i++) { id[i] = UserThreadCreate(&fun, 0); //Some check for the threads creation if(id[i] < 0) { PutString("Error while creating thread\n"); // Wait for putstring UserThreadJoin(id[i]-1, 0); return -1; } } for(i=0;i<NB_THREADS;i++) { //Joining all threads if(UserThreadJoin(id[i], 0) == -1) { PutString(" joined failed! "); } } PutString("\nParent finish\n"); return 0; }
int main() { int tid1 = UserThreadCreate(&fun2, 0); int tid2 = UserThreadCreate(&fun, (void *)tid1); if (tid1 == -1 || tid2 == 1) { PutString("Error while creating thread\n"); return -1; } PutString("T1 joining...\n"); if (UserThreadJoin(tid1, 0) != 0) PutString("Error !\n"); return 0; }
int main(){ SynchPutString("\nProcess 6 lancé !\n"); int t1, t2; t1 = UserThreadCreate(print,(void *) 7); t2 = UserThreadCreate(print,(void *) 8); SynchPutString("\nJe suis le Process 6 et j'ai fini mon travail dans le main principal !\n"); //char a = SynchGetChar(); return 0; }
int main() { PutString("\n-----------------------------------------\n"); PutString("Lancement du test testJoinAttenteRec : \n"); PutString("Lance 3 threads f, g et h. Le main attend f qui attend g qui attend h.\n"); PutString("-----------------------------------------\n"); int tidf, tidg, tidh; tidh = UserThreadCreate(h, 0); tidg = UserThreadCreate(g, &tidh); tidf = UserThreadCreate(f, &tidg); if(UserThreadJoin(tidf, 0) == -1) PutString("Erreur join du main sur f\n"); PutString("Fin du main\n"); return 0; }
int main(int argc, char** argv) { char a = 'a', b = 'b', c = 'c'; int tidA, tidB, tidC; tidA = UserThreadCreate(Thread, &a); tidB = UserThreadCreate(Thread, &b); tidC = UserThreadCreate(Thread, &c); UserThreadJoin(tidA); UserThreadJoin(tidB); UserThreadJoin(tidC); return 0; }
int main() { PutString("\n-----------------------------------------\n"); PutString("Lancement du test testJoinThreadFini2 : \n"); PutString("Lance 2 threads et les attend, le 2e attendu est deja termine.\n"); PutString("-----------------------------------------\n"); int tidf, tidg; int th_ret; tidg = UserThreadCreate(g, 0); tidf = UserThreadCreate(f, 0); if(UserThreadJoin(tidf, &th_ret) == -1) PutString("Erreur join sur f\n"); if(UserThreadJoin(tidg, &th_ret) == -1) PutString("Erreur join sur g\n"); PutString("Fin du main\n"); return 0; }
int main() { int i = 0; for ( i = 0 ; i < 5 ; i++) UserThreadCreate(print,(void*)i); PutChar('E'); return 0; }
int main() { PutString("Parent start\n"); UserThreadCreate((void*)-1, 0); int i; for(i=0;i<10000;i++); PutString("Parent finish\n"); return 0; }
int main() { int i = 0; int t1; for (i=0; i<3000; i++) { t1 = UserThreadCreate(print2, (void *)'c'); UserThreadJoin(t1); } return 0; }
int main(){ int i; int arg=0; for(i=0;i<6;i++){ UserThreadCreate(function,(void *)arg); arg++; } Exit(0); }
int main() { pthread tid; UserThreadCreate(f, (void *) THIS, &tid); UserThreadCreate(f, (void *) THIS, &tid); // UserThreadCreate(f, (void *) THIS, &tid); // UserThreadCreate(f, (void *) THIS, &tid); // UserThreadCreate(f, (void *) THIS, &tid); ForkExec("multiplethreads"); b((void*) THAT); b((void*) THAT); b((void*) THAT); PutString("\nUserPages0 has terminated...\n"); return 0; }
int main() { UserThreadCreate(f, 0); PutString("Thread main\n"); PutChar('a'); PutString("\n"); PutInt(1); PutString("\n"); return 0; }
int main() { PutString("Parent start\n"); int x = 42; UserThreadCreate(&fun, &x); int i; for(i=0;i<10000;i++); PutString("Parent finish\n"); return 0; }
int main() { int m,n; int t1; t1 = UserThreadCreate(print, (void *)'z'); UserThreadJoin(t1); for (m=0; m<3; m++) { for (n=0; n<3000; n++) {} PutChar('K'); } return 0; }
int main() { PutString("\n-----------------------------------------\n"); PutString("Lancement du test threadParallele3 : \n"); PutString("Lance un thread qui lance un autre thread etc. (cree 3 threads).\n"); PutString("Tous les threads doivent se terminer avant que le processus s'arrete.\n"); PutString("-----------------------------------------\n"); UserThreadCreate(f, 0); PutString("Thread main fini\n"); return 0; }
void Thread(void* arg) { int* i = (int*) arg; PutChar('T'); PutInt(*i); PutChar('\n'); (*i)--; if (*i > 0) { int tid = UserThreadCreate(Thread, arg); UserThreadJoin(tid); } UserThreadExit(); }