Programatic way to determine the contents of struct pthread_*_t...
Sean Chittenden
sean at chittenden.org
Wed Sep 19 09:12:43 PDT 2007
Howdy. What's the best way to programatically gain access to the
contents of the various struct pthread_*_t members? In OS-X and
Linux, the contents are defined in /usr/include/*/_*pthreads.h, but
that doesn't appear to be the case for FreeBSD at the moment. I'm in
the process of porting D's Tango runtime to FreeBSD[1] and it appears
that due to FreeBSD's multi-thread model, this is a bit problematic.
Is there an obvious (or not so obvious) magic woobie stick that I can
shake at this problem? I'm mostly done with the port at this point,
but am a bit perplexed as to how to approach the poking at internals
problem since D's runtime environment is possibly tied to my kernel
configuration. Less than keen on that reality. Can I safely assume
that libthr is now king of the hill and isn't about to be dethroned
anytime soon?
Having looked at src/lib/lib(thr|pthread)/thread/thr_private.h - the
sizes are different, the contents are different, etc. Given other
platforms have this publicly defined in userspace and we don't... is
this going to get kicked over to userland again at somepoint or are
we always going to be indirectly passing around pthread_*_t structs?
Thoughts/suggestions? Thanks in advance! -sc
[1] D is a slick language and very much worth a hander if you haven't
poked at it before. Tango is an alternate standard class library and
runtime environment for D that has many performance advantages over
the stock runtime environment.
Tango Info: http://www.dsource.org/projects/tango
D Info: http://www.digitalmars.com/d/
PS Very aware of the dangers/stupidity associated with poking at the
contents of structures, but for the time being, that's how tango
works for threading compatibilities. If there's a #define that
specifies the version number of the pthreads structures, I'd love to
make use of it as a safety belt.
--
Sean Chittenden
sean at chittenden.org
More information about the freebsd-threads
mailing list