Compiling with pthreads

Richard W.M. Jones rjones at redhat.com
Fri Mar 13 14:18:30 UTC 2009


On Fri, Mar 13, 2009 at 02:57:11PM +0100, Kevin Kofler wrote:
> Daniel P. Berrange wrote:
> > win32 pthreads is a mess in this respect. config.h is a file generated
> > by their configure.ac,which has all the autoconf HAVE_XXX macros set.
> > Even worse, this file is included in pthread.h, thus totally polluting
> > your application's namespace. IMHO, this makes win32 pthreads unusable
> 
> Ugh. This really needs to be fixed or worked around somehow. Maybe the
> unifdef tool can help?
> 
> I don't understand why it's doing configure checks at all as it's targeting
> a single operating system with a stable API/ABI.

There's not a great deal of usage of these macros.  We could easily
fix the public headers to not need config.h:

$ grep HAVE_ *.h | fgrep -v config.h
implement.h:#if defined(HAVE_C_INLINE) || defined(__cplusplus)
implement.h:#if HAVE_SIGSET_T
implement.h:#endif				/* HAVE_SIGSET_T */
implement.h:#if HAVE_SIGSET_T
implement.h:#endif				/* HAVE_SIGSET_T */
pthread.h:#   define HAVE_STRUCT_TIMESPEC 1
pthread.h:#   define HAVE_SIGNAL_H        1
pthread.h:#   undef HAVE_CONFIG_H
pthread.h:#if HAVE_CONFIG_H
pthread.h:#endif /* HAVE_CONFIG_H */
pthread.h:#if HAVE_SIGNAL_H
pthread.h:#endif /* HAVE_SIGNAL_H */
pthread.h:#    define HAVE_MODE_T
pthread.h:#ifndef HAVE_STRUCT_TIMESPEC
pthread.h:#define HAVE_STRUCT_TIMESPEC 1
pthread.h:#endif /* HAVE_STRUCT_TIMESPEC */
sched.h:#    define HAVE_MODE_T
semaphore.h:#    define HAVE_MODE_T
semaphore.h:#ifndef HAVE_MODE_T

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/



More information about the mingw mailing list