Interesting ... if I reserver memory for the tid1 I get a positive BIG number AND its the same every time I run the program, while tid2 gets a BIG negative number, which is different every time??
pthread_t *tid1, tid2;
tid1 = (pthread_t *)malloc((sizeof(pthread_t)));
pthread_create(tid1, NULL, thread1, (void *)tst);
printf("tid1: %d\n", tid1);
pthread_create(&tid2, NULL, thread2, (void *)tid2);
printf("tid2: %d\n", tid2);
Anyone that can explain for me? I want the tid of the thread I'm creating, when I create it. Can I pick it out in someway of this values?