ZIGLIO, Frediano, VF-IT
Frediano.Ziglio at vodafone.com
Tue Aug 29 08:03:01 EDT 2006
> On Wed, Aug 23, 2006 at 09:59:05PM +0200, Frediano Ziglio wrote:
> > I think you are right, if one don't want thread safety we shouldn't
> > check for thread-safe functions although nowadays threads are very
> > common so I don't suggest the use of this flag.
> Hi Freddy,
> Common, but not ubiquitous. Someone you know pretty well,
> someone I know
> very well, uses NetBSD 2.0. At the moment I, er, he can't
> compile because
> --disable-threadsafe stumbles. See attached.
> The NetBSD kernel has threads, and its userland implement an
> M-N threading
> model, but not every function is available, including some important
> *_r functions. I keep tring to compile FreeTDS with threads
> with each new
> version of NetBSD, but so far --disable-threadsafe is my best
> friend. Or
> was. :-(
> As a db-lib and Perl programmer, I have no use for threads.
> I have no use for them at all. I think they're a terrible
> idea that set
> computing back 30 years.) So I'd be really glad to see this option
> working again.
I agree it should compile. But I didn't realized that it do not compile
where it compiled...
I think that it do not compile cause we added some configuration for
thread that cause some miss-detecting... I think the problem reside in
2=1.10 change (mainly ACX_PTHREAD use). IMHO thread detect is quite
wrong currently... trying to extract m4 from configure.ac
if test $netdb_reentrant = yes; then
AC_DEFINE(NETDB_REENTRANT, 1, [Define to 1 if the BSD-style netdb
interface is reentrant.])
AC_CHECK_FUNCS([vsnprintf gettimeofday \
nl_langinfo locale_charset setenv putenv \
getuid getpwuid getpwuid_r fstat alarm \
AC_CHECK_FUNCS([inet_ntoa_r getipnodebyaddr getipnodebyname freehostent
getaddrinfo getnameinfo inet_ntop inet_pton \
gethostname sethostent_r gethostent_r])
AC_REPLACE_FUNCS([asprintf vasprintf atoll strtok_r readpassphrase \
strlcpy strlcat basename])
# Enable or disable thread safetiness
# This option is enabled by default because most OS's support it.
# A more sophisticated approach would be to set the default per-OS.
AS_HELP_STRING([--disable-threadsafe], [disable calls to
threadsafe fuctions e.g.,gethostbyname_r ]),
if test "$enable_threadsafe" != "no" ; then
CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE"
AM_CONDITIONAL(ENABLE_THREADSAFE, test "$enable_threadsafe" != "no")
# we don't need to check netdb functions if they are already threadsafe
if test $netdb_reentrant != yes; then
# easy test for pthread (no library, only mutex support)
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;],
pthread_mutex_unlock(&mutex)], AC_DEFINE(TDS_HAVE_PTHREAD_MUTEX, 1,
[Define if you have pthread with mutex support]))
- thread support is tested with ACX_PTHREAD even if --disable-threadsafe
- PTHREAD_CC and PTHREAD_CFLAGS are not used by all configure tests...
should them be used and ACX_PTHREAD called ASAP ?
- we test for getXXXbyXXX_r only if netdb_reentrant is no but in
src/tds/threadsafe.c we require _r functions (why did the code work
before ACX_PTHREAD call?)
- we test for mutex even if --disable-threadsafe is specified (and with
More information about the FreeTDS