[Python-Dev] pthreads question: typedef ??? pthread_t and hacky return statements

Trent Mick trentm@ActiveState.com
Fri, 18 Aug 2000 09:56:24 -0700


On Fri, Aug 18, 2000 at 04:00:34AM -0700, Greg Stein wrote:
> That is a silly approach, Tim. This is exactly what autoconf is for. Using
> run-time logic to figure out something that is compile-time is Badness.
> 
> > > On Thu, Aug 17, 2000 at 11:39:29PM -0400, Tim Peters wrote:
> > >
> > > > So how about a runtime test for what's actually important (and it's not
> > > > Monterey!)?
> > > >
> > > > 	if (sizeof(threadid) <= sizeof(long))
> > > > 		return (long)threadid;
> > > >
> > > > End of problem, right?  It's a cheap runtime test in a function
> > > > whose speed isn't critical anyway.
> > >

I am inclined to agrre with Thomas and Greg on this one. Why not check for
sizeof(pthread_t) if pthread.h exists and test:

#if SIZEOF_PTHREAD_T < SIZEOF_LONG
    return (long)threadid;
#endif


Trent

-- 
Trent Mick
TrentM@ActiveState.com