pthread_t in 5.3

Medi Montaseri mmontaseri at amcc.com
Thu Jan 27 14:33:59 PST 2005


I am confused about the pthread_t type in FreeBSD 5.3,  can you help..

Based on /usr/include/pthread.h,
typedef struct  pthread                 *pthread_t;
and when I look for the declaration of "struct pthread" , all I find is
a forward declaration with a comment that says,

/*
 * Forward structure definitions.
 *
 * These are mostly opaque to the user.
 */
struct pthread;

That is 'struct pthread' is an opaque type....
Then in my application, when I try to find my thread_id, I say

cout << "my tid is " << pthread_self() << endl;
and I get a hex value. Which is syntactically correct, but semantically 
in-correct.
I'm not interested in the pointer, I'm interested in the numerical 
thread ID...
Now at this point, you'll think all you have to do is to de-reference 
the pointer.
But since 'struct pthrad' is opaque, gdb and myself are clueless to 
proceed from here.
Can someone shed some light on this please...

Thanks


More information about the freebsd-threads mailing list