#include <stdio.h> 
#include <pthread.h> 
#include <sys/neutrino.h> 
pthread_t thread_id1; 
pthread_t thread_id2;
pthread_t thread_id3;
void *long_thread1(void *notused) 
{ 
    int n; 
    for(n=0;n<5;n++) {
        printf("Potok 1: TID=%d, N povtora %d \n", 
        thread_id1, n);
        sleep(2); 
    } 
} 
void *long_thread2(void *notused) 
{ 
    int m; 
    for(m=0; m<5; m++) { 
        printf("Potok 2: TID=%d, N povtora %d \n", 
        thread_id2 , m); 
        sleep(1); 
    } 
} 
void *long_thread3(void *notused) 
{ 
    int p; 
    for(p=0; p<5; p++) { 
        printf("Potok 3: TID=%d, N povtora %d \n", 
        thread_id3 , p); 
        sleep(1); 
    } 
} 
int main(void) 
{ 
    printf("Prog threads PID %d \n",getpid()); 
    pthread_create(&thread_id1, NULL, long_thread1, NULL);
    pthread_create(&thread_id2, NULL, long_thread2, NULL);
    pthread_create(&thread_id3, NULL, long_thread3, NULL);
    sleep(40); 
    return(1); 
} 
