curl-library
RE: cannot connect to server in a subthread
Date: Tue, 14 Oct 2008 17:44:17 +0200
Yang Tse wrote:
> It seems quite clear that _REENTRANT should be unconditionally defined
for Solaris when using threads. But what do we do if these are not going
to be used ? Do we make this definition depend on --enable-threads ?
Some more info from my long term memory: :-)
If you do not define _REENTRANT, errno is a #define that resolves into a
simple global variable name.
Else it resolves to an indirection to the result of a library procedure
call (this procedure probably returns a pointer to some thread-private
area).
I tried to execute a non-threaded program compiled with -D_REENTRANT: it
worked. This means the low level library procedure mentionned above is
aware of the situation. This is just trial, not a rule. However it makes
sense to not have 2 different versions of each library, if those have to
also be functional in a threaded environment, even if not dealing
directly with threads.
I can reasonably imagine that a non-threaded program compiled with
-D_REENTRANT (or using a library compiled as such) runs properly, but is
only a bit slower due to additional overhead.
This is just experimentation and reasoning, not a predicate !
Received on 2008-10-14