what does __gthread_active_p() do/mean?

Jeff Sturm jsturm@one-point.com
Fri Jan 18 02:24:00 GMT 2002


On 17 Jan 2002, Adam Megacz wrote:
> So the assumption that "no -mthreads == no threads" isn't always true.

True.  Most platforms have some way to explicitly request a threaded
runtime, e.g. -lpthread.  For those it's critical that they can disable
the gthr-* functionality.

But for mingw, win32 thread functions are always available with or without
-mthreads.  So you could probably make your proposed modification without
breaking anything (in a single-threaded program, freeing the TLS isn't an
issue).

> Would anybody object to having this always return 1 on mingw
> platforms? The TlsGet() and TlsSet() functions which it enables don't
> require mingwthr.dll.

I'm not exactly objecting, but realize that this will add some overhead to
mingw programs that use EH without threads.  There ought to be a way to
declare to the compiler that you don't intend to use threads, and
ostensibly this is done now by omitting -mthreads.

Alternatively, could you somehow eliminate libmingwthrd from the link
spec?  Perhaps handle threads in the STARTFILE_SPEC instead?

Jeff



More information about the Gcc mailing list