Date: Thu, 27 Jan 2005 16:30:47 -0800 From: "Medi Montaseri" <mmontaseri@amcc.com> To: Daniel Eischen <deischen@freebsd.org> Cc: freebsd-threads@freebsd.org Subject: Re: pthread_t in 5.3 Message-ID: <41F987B7.7080308@amcc.com> In-Reply-To: <Pine.GSO.4.43.0501271919080.8533-100000@sea.ntplx.net> References: <Pine.GSO.4.43.0501271919080.8533-100000@sea.ntplx.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Eischen wrote: >On Thu, 27 Jan 2005, Medi Montaseri wrote: > > > >>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. >> >> > >Sorry, what pthread_t is, is not for you to know. It is up to the >implementation to define it anyway that it wants. And is also why >there is a pthread_equal() function. > > > >>I'm not interested in the pointer, I'm interested in the numerical >>thread ID... >> >> > >There is no such thing as defined by POSIX. > > > >>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... >> >> > >I think you are trying to do something that is non-standard/portable. > >-- >DE > > > But on linux, a thread_t is typedef unsigned long int pthread_t; I guess the idea was if a file descriptor is a int and a socket is an int and a process id is an int then a thread also be an int and people can have an array of those IDs.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41F987B7.7080308>