#include <thread.h>
#include <stdlib.h>
#include <stdio.h>
int global=0;
void * myfunc1() {
  int i;
  for(i=1; i<=10; i++) {
    global=global+1;
    sleep(2);
    printf("Thread loopu %d \n",global);
  }
}
void * myfunc2() {
  int i;
  for(i=1; i<=10; i++) {
    global=global+1;
    sleep(2);
    printf("Thread loopu %d \n",global);
  }
}
void * myfunc3() {
  int i;
  for(i=1; i<=10; i++) {
    global=global+1;
    sleep(2);
    printf("Thread loopu %d \n",global);
  }
}
void * myfunc4() {
  int i;
  for(i=1; i<=10; i++) {
    global=global+1;
    sleep(2);
    printf("Thread loopu %d \n",global);
  }
}
int main() {
  int threadid1,threadid2,threadid3,threadid4;
  thr_create (NULL, 0, myfunc1, NULL, 0, &threadid1);
  thr_create (NULL, 0, myfunc2, NULL, 0, &threadid2);
  thr_create (NULL, 0, myfunc3, NULL, 0, &threadid3);
  thr_create (NULL, 0, myfunc4, NULL,0, &threadid4);
  thr_join(NULL, NULL, NULL); return 0;
}
