Re: Is there such a thing as an invalid thread id?



Buckaroo_Banzi wrote:
I am creating a threaded application and just wish to return the thread
id to the calling function. I am looking to let the calling function
determine if pthread_create worked by the thread id.

I have a feeling that there is a thread id value that indicates an
invalid thread, such as 0 or -1. Could someone let me know if this is
true and if so what value indicates an invalid thread?
Peeking through SUSv2, I can't find any such requirements, but I might
not have looked hard enough.
Do similar to what pthread_does, return the thread id through
a pointer argument, and success/failure as the function return value.

int thr_function(pthread_t *tid);
...
pthread_t tid;
if(thr_function(&tid) {
	/*failed */
}
.