void print(int i) { if (i % 2) PutString("Je suis un nombre impair\n"); else PutString("Je suis un nombre pair\n"); UserThreadExit(); }
void f(void* arg) { if(PutString("thread f\n") == -1) PutString("Erreur putstring\n"); PutString("Thread f fini\n"); UserThreadExit(42); }
void print(char c) { int j = 0, i=0; for (j=0; j<1; j++) { for (i=0; i<1; i++) {} } UserThreadExit(); }
void Thread(void* arg) { char* c = (char*) arg; int i; for (i = 0; i < 50; i++) { PutChar(*c); } UserThreadExit(); }
void *fun(void* arg) { PutString("Child start\n"); PutInt(*(int*)arg); PutString("\nChild finish\n"); UserThreadExit(0); return 0; }
void f(void *arg) { int i; PutChar(*((char *)arg)); for(i=0; i<20; i++){}; PutString("Inside User Thread \n"); UserThreadExit(); }
void print(char c) { int j = 0, i=0; for (j=0; j<3; j++) { for (i=0; i<3000; i++) {} PutChar(c); } UserThreadExit(); }
void print2(char d) { int k = 0; while(k==5){ PutChar('c'); k++; } UserThreadExit(); }
void print(int i){ int j = 0; for(j = 0; j < 150; j++){ PutChar(i); } UserThreadExit(); }
void f(void* arg) { PutString("Thread 2\n"); PutChar('b'); PutString("\n"); PutInt(2); PutString("\n"); UserThreadExit(0); }
void f(void* arg) { int n = *((int*)arg); SemWait(&s); PutInt(n); PutString("\n"); SemPost(&s); UserThreadExit(0); }
int main() { PutString("\n-----------------------------------------\n"); PutString("Lancement du test threadMainExit : \n"); PutString("Test l'appel de UserThreadExit par le main avec une valeur de retour.\n"); PutString("-----------------------------------------\n"); UserThreadExit(5); return 0; }
void SimpleThread(void* which) { int i; sem_P(*((struct s*)which)->sem); for (i = 0; i < 1000; i++) { PutChar(((struct s*)which)->c); } sem_V(*((struct s*)which)->sem); UserThreadExit(); }
void print(int c) { int i,n; n = 500000; for (i = 0; i < n; i++) { } PutChar('J'); UserThreadExit(); }
void *fun(void* arg) { int i; for(i=0;i<10000;i++); UserThreadExit((void *)42); return 0; }
void SimpleThread(void* which) { char* ch = (char*) which; int i; for (i = 0; i < 10; i++) { PutChar(*ch); PutInt(i); PutChar('\n'); } UserThreadExit(); }
void f(void* arg) { PutChar('5'); Arg *param = (Arg*) arg; PutChar(param->a); PutChar('6'); param->wait = 0; PutChar('7'); UserThreadExit(0); }
void f(void* arg) { int* n = (int*)arg; int i; for(i = 0 ; i < 50 ; i++) { PutInt(*n); } PutString("\n"); UserThreadExit(0); }
void Thread2(void* arg) { int tid = *(int*) arg; int i; for (i = 0; i < 500; i++) { PutChar('d'); } PutChar('Q'); UserThreadJoin(tid); PutChar('Z'); UserThreadExit(); }
void func (void *arg) { PutString("I am in user thread!\n"); int tmp = 1; int i; for (i = 1; i < 100; ++i) { tmp *= 123*i; } PutString("I am again in user thread!\n"); UserThreadExit(); }
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(); }
int main() { char number = '2'; int i,j; j=UserThreadCreate(f, (void *) &number); UserThreadJoin(j); for(i=0; i<2000; i++){}; PutString("Inside Main Thread \n"); UserThreadExit(); return 0; }
int main() { int tid = 0; tid = UserThreadCreate(&fun, 0); tid = tid; // make gcc happy PutString("La "); UserThreadExit(0); PutString("Mort\n"); return 1; }
void print(int i){ int j = 0; for(j = 0; j < 3; j++){ if(i%2 == 0){ SynchPutString("Coucou, je m'execute dans un thread avec un param pair !"); }else{ SynchPutString("Coucou, je m'execute dans un thread avec un param impaire !"); } } //char z = SynchGetChar(); //PutChar(z); UserThreadExit(); }
void print(int i){ int j = 0; for(j = 0; j < 3; j++){ if(i%2 == 0){ SynchPutString("Coucou, Process 6 thread 1 !"); }else{ SynchPutString("Coucou, Process 6 thread 2 !"); } } if(i%2 == 0){ SynchPutString("\nProcess 6 thread 1 terminé !\n"); }else{ SynchPutString("\nProcess 6 thread 2 terminé !\n"); } //char z = SynchGetChar(); //PutChar(z); UserThreadExit(); }
void f(void* arg) { UserThreadCreate(g, 0); PutString("Thread 1 fini\n"); UserThreadExit(0); }
void f(void *s) { int i; for (i = 0; i < N; i++) puts((char *)s); UserThreadExit(); }
void f(void *a) { UserThreadExit(0); }
void g(void* arg) { UserThreadCreate(fin, 0); PutString("Thread 2 fini\n"); UserThreadExit(0); }
void fin(void* arg) { PutString("Thread 3 fini\n"); UserThreadExit(0); }