creating multiple threads using single thread id

Hi all,

Can I create multiple threads using single thread_id

like

pthread_t thread_id;
pthread_create(&thread_id, NULL, &print_xs, NULL);
pthread_create(&thread_id, NULL, &print_ys, NULL);
pthread_create(&thread_id, NULL, &print_zs, NULL);
pthread_join(thread_id, NULL);

what will be the impact of this? please suggest...

Thanks......

pthread_create does not take a thread ID, it overwrites the value of thread_id. That's why it's a pointer, you're telling it what memory to overwrite.

So you could create lots with the same variable, but you'd just be overwriting the same value every time and losing track of everything but the last created thread, not creating threads with the same ID.

ok that means execution will go on but I will not have the track record, I will loss..

Thanks